logmower-shipper/pkg/sender/metrics.go
2022-11-09 18:07:28 +02:00

42 lines
1.5 KiB
Go

package sender
import (
"git.k-space.ee/k-space/logmower-shipper/pkg/globals"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
var (
promShipperQueued = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: globals.PrometheusPrefix,
// Subsystem: "shipper",
Name: "shipper_record", // "queued",
Help: "Log records in queue to be batched and sent to database",
}, []string{"filename"})
promShipperDbSent = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: globals.PrometheusPrefix,
// Subsystem: "shipper",
Name: "record", // "sent",
Help: "Log records successfully committed to database",
}, []string{"filename"})
promShipperBatchSizeResult = promauto.NewHistogram(prometheus.HistogramOpts{
Namespace: globals.PrometheusPrefix,
// Subsystem: "shipper",
Name: "bulk_submission_message", // "items_in_batch"
Help: "Batch size for database submissions",
Buckets: []float64{1, 5, 10, 50, 100, 500, 1000, 5000, 10000},
})
promShipperDbSendError = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: globals.PrometheusPrefix,
// Subsystem: "shipper",
Name: "insertion_error", // "errors",
Help: "Errors while submitting to database", // TODO:
}, []string{"filename"})
promShipperSynced = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: globals.PrometheusPrefix,
Subsystem: "shipper",
Name: "batches_synced",
Help: "All batches available have been committed database (0 or 1)",
}, []string{"filename"})
)