diff --git a/pkg/services/ngalert/metrics/metrics.go b/pkg/services/ngalert/metrics/metrics.go index 6e6a2035bf0..f0cdaca3f11 100644 --- a/pkg/services/ngalert/metrics/metrics.go +++ b/pkg/services/ngalert/metrics/metrics.go @@ -81,7 +81,7 @@ func NewMetrics(r prometheus.Registerer) *Metrics { }), // TODO: once rule groups support multiple rules, consider partitioning // on rule group as well as tenant, similar to loki|cortex. - EvalTotal: prometheus.NewCounterVec( + EvalTotal: promauto.With(r).NewCounterVec( prometheus.CounterOpts{ Namespace: "grafana", Subsystem: "alerting", @@ -92,7 +92,7 @@ func NewMetrics(r prometheus.Registerer) *Metrics { ), // TODO: once rule groups support multiple rules, consider partitioning // on rule group as well as tenant, similar to loki|cortex. - EvalFailures: prometheus.NewCounterVec( + EvalFailures: promauto.With(r).NewCounterVec( prometheus.CounterOpts{ Namespace: "grafana", Subsystem: "alerting", @@ -101,7 +101,7 @@ func NewMetrics(r prometheus.Registerer) *Metrics { }, []string{"user"}, ), - EvalDuration: prometheus.NewSummaryVec( + EvalDuration: promauto.With(r).NewSummaryVec( prometheus.SummaryOpts{ Namespace: "grafana", Subsystem: "alerting", @@ -113,7 +113,7 @@ func NewMetrics(r prometheus.Registerer) *Metrics { ), // TODO: once rule groups support multiple rules, consider partitioning // on rule group as well as tenant, similar to loki|cortex. - GroupRules: prometheus.NewGaugeVec( + GroupRules: promauto.With(r).NewGaugeVec( prometheus.GaugeOpts{ Namespace: "grafana", Subsystem: "alerting",