use baseName for prometheus
This commit is contained in:
		| @@ -2,6 +2,7 @@ package logmower | ||||
|  | ||||
| import ( | ||||
| 	"context" | ||||
| 	"path/filepath" | ||||
| 	"time" | ||||
|  | ||||
| 	"github.com/jtagcat/util" | ||||
| @@ -77,8 +78,9 @@ func (s *submitter) sender(name string, sendQueue <-chan mLog) (synced func() bo | ||||
| 		defer cancel() | ||||
|  | ||||
| 		go func() { | ||||
| 			baseName := filepath.Base(name) | ||||
| 			for { | ||||
| 				promShipperQueueItems.WithLabelValues(name).Observe(float64( | ||||
| 				promShipperQueueItems.WithLabelValues(baseName).Observe(float64( | ||||
| 					len(sendQueue))) | ||||
|  | ||||
| 				timer := time.NewTimer(time.Second) | ||||
| @@ -105,9 +107,11 @@ func (s *submitter) sender(name string, sendQueue <-chan mLog) (synced func() bo | ||||
| func (s *submitter) senderRoutine(name string, batched <-chan []mLog, synced *bool) { | ||||
| 	defer s.Done() | ||||
|  | ||||
| 	baseName := filepath.Base(name) | ||||
|  | ||||
| 	for { | ||||
| 		*synced = true | ||||
| 		promShipperSynced.WithLabelValues(name).Set(1) | ||||
| 		promShipperSynced.WithLabelValues(baseName).Set(1) | ||||
|  | ||||
| 		batch, ok := <-batched | ||||
| 		if !ok { | ||||
| @@ -115,7 +119,7 @@ func (s *submitter) senderRoutine(name string, batched <-chan []mLog, synced *bo | ||||
| 		} | ||||
|  | ||||
| 		*synced = false | ||||
| 		promShipperSynced.WithLabelValues(name).Set(0) | ||||
| 		promShipperSynced.WithLabelValues(baseName).Set(0) | ||||
|  | ||||
| 		var batchBson []interface{} // mongo does not like typing | ||||
| 		for _, b := range batch { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user