logmower-shipper/pkg/sender/metrics.go

39 lines
1.6 KiB
Go
Raw Normal View History

2022-11-09 16:07:28 +00:00
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"
)
2022-11-09 19:13:36 +00:00
const promSubsystem = "shipper"
2022-11-09 16:07:28 +00:00
var (
promShipperQueued = promauto.NewGaugeVec(prometheus.GaugeOpts{
2022-11-09 19:13:36 +00:00
Namespace: globals.PrometheusPrefix, // Subsystem: promSubsystem,
Name: "shipper_record", // "queued",
Help: "Log records in queue to be batched and sent to database",
2022-11-09 16:07:28 +00:00
}, []string{"filename"})
promShipperDbSent = promauto.NewCounterVec(prometheus.CounterOpts{
2022-11-09 19:13:36 +00:00
Namespace: globals.PrometheusPrefix, // Subsystem: promSubsystem,
Name: "record", // "sent",
Help: "Log records successfully committed to database",
2022-11-09 16:07:28 +00:00
}, []string{"filename"})
promShipperBatchSizeResult = promauto.NewHistogram(prometheus.HistogramOpts{
2022-11-09 19:13:36 +00:00
Namespace: globals.PrometheusPrefix, // Subsystem: promSubsystem,
Name: "bulk_submission_message", // "items_in_batch"
Help: "Batch size for database submissions",
Buckets: []float64{1, 5, 10, 50, 100, 500, 1000, 5000, 10000},
2022-11-09 16:07:28 +00:00
})
promShipperDbSendError = promauto.NewCounterVec(prometheus.CounterOpts{
2022-11-09 19:13:36 +00:00
Namespace: globals.PrometheusPrefix, // Subsystem: promSubsystem,
Name: "insertion_error", // "errors",
Help: "Failed database bulk insertions",
2022-11-09 16:07:28 +00:00
}, []string{"filename"})
promShipperSynced = promauto.NewGaugeVec(prometheus.GaugeOpts{
2022-11-09 19:13:36 +00:00
Namespace: globals.PrometheusPrefix, Subsystem: promSubsystem,
Name: "batches_synced",
Help: "All batches available have been committed database (0 or 1)",
2022-11-09 16:07:28 +00:00
}, []string{"filename"})
)