frostfs-s3-gw/metrics/logs.go
Pavel Pogodaev 99ff86a0d1 [#502] Add Dropped logs (by sampling) metric
Signed-off-by: Pavel Pogodaev <p.pogodaev@yadro.com>
2024-11-21 15:57:26 +03:00

38 lines
659 B
Go

package metrics
import "github.com/prometheus/client_golang/prometheus"
const (
droppedLogs = "dropped_logs"
)
type logsMetric struct {
droppedLogs prometheus.Counter
}
func newLogsMetrics() *logsMetric {
return &logsMetric{
droppedLogs: mustNewCounter(appMetricsDesc[statisticSubsystem][droppedLogs]),
}
}
func (m *logsMetric) DroppedLogsInc() {
if m == nil {
return
}
m.droppedLogs.Inc()
}
func (m *logsMetric) Describe(descs chan<- *prometheus.Desc) {
if m == nil {
return
}
m.droppedLogs.Describe(descs)
}
func (m *logsMetric) Collect(metrics chan<- prometheus.Metric) {
if m == nil {
return
}
m.droppedLogs.Collect(metrics)
}