refactor prometheus metrics

This commit is contained in:
rasmus 2022-11-06 15:57:05 +02:00
parent a56e6d1ffc
commit b03c845406
3 changed files with 10 additions and 10 deletions

View File

@ -14,21 +14,21 @@ import (
func mongoMonitoredClientOptions(l *zap.Logger) *mongoOpt.ClientOptions {
promMongoHeartbeat := promauto.NewHistogramVec(prom.HistogramOpts{
Subsystem: "mongo",
Name: "heartbeat",
Name: "heartbeat_time",
Help: "Time in ns for succeeded heartbeat, or 0 on failure",
Buckets: []float64{1},
}, []string{"connection_id"})
promMongoCmd := promauto.NewHistogramVec(prom.HistogramOpts{
Subsystem: "mongo",
Name: "command",
Name: "command_time",
Help: "Time in ns of commands",
Buckets: prom.DefBuckets,
}, []string{"connection_id", "command_name"})
promMongoCmdErr := promauto.NewCounterVec(prom.CounterOpts{
Subsystem: "mongo",
Name: "errors_count",
Name: "errors",
Help: "Count of failed commands",
}, []string{"connection_id", "command_name"})

View File

@ -85,12 +85,12 @@ var App = &cli.App{
promErrWatching = promauto.NewCounter(prom.CounterOpts{
Subsystem: "watcher",
Name: "errors_count",
Name: "errors",
Help: "Error in logmower watching log files",
})
promFilesRead = promauto.NewCounter(prom.CounterOpts{
Subsystem: "watcher",
Name: "file_count",
Name: "seen_files",
Help: "Number of tracked log files",
})
)

View File

@ -15,27 +15,27 @@ import (
var (
promShipperMongoSent = promauto.NewCounterVec(prom.CounterOpts{
Subsystem: "shipper",
Name: "sent_count",
Name: "sent",
Help: "Items successfully committed to mongo",
}, []string{"filename"})
promShipperMongoSentError = promauto.NewCounterVec(prom.CounterOpts{
Subsystem: "shipper",
Name: "mongo_errors_count",
Name: "mongo_errors",
Help: "Errors while submitting to mongo", // TODO:
}, []string{"filename"})
promShipperDropped = promauto.NewCounterVec(prom.CounterOpts{
Subsystem: "shipper",
Name: "queue_dropped_count",
Name: "queue_dropped",
Help: "Items ready to be batched and sent to mongo, but dropped due to full queue",
}, []string{"filename"})
promLineParsingErr = promauto.NewCounterVec(prom.CounterOpts{
Subsystem: "shipper",
Name: "lines_parsing_err_count",
Name: "lines_parsing_errors",
Help: "Errors while parsing log line suffixes",
}, []string{"filename"})
promShipperQueueItems = promauto.NewHistogramVec(prom.HistogramOpts{
Subsystem: "shipper",
Name: "queue_items",
Name: "queued",
Help: "Items in queue to be batched and sent to mongo",
}, []string{"filename"})
promShipperSynced = promauto.NewGaugeVec(prom.GaugeOpts{