Alerting: Add status label to GroupRules metric (#63454)

* Add status label to GroupRules metric

* Add state (active and paused) label to GrouRules

* Add active/paused metrics tests
This commit is contained in:
Alex Moreno
2023-02-23 12:38:27 +01:00
committed by GitHub
parent f3714099e7
commit f60dc4441f
3 changed files with 120 additions and 17 deletions

View File

@@ -7,6 +7,11 @@ import (
"github.com/grafana/grafana/pkg/util/ticker"
)
const (
AlertRuleActiveLabelValue = "active"
AlertRulePausedLabelValue = "paused"
)
type Scheduler struct {
Registerer prometheus.Registerer
BehindSeconds prometheus.Gauge
@@ -69,9 +74,9 @@ func NewSchedulerMetrics(r prometheus.Registerer) *Scheduler {
Namespace: Namespace,
Subsystem: Subsystem,
Name: "rule_group_rules",
Help: "The number of rules.",
Help: "The number of alert rules that are scheduled, both active and paused.",
},
[]string{"org"},
[]string{"org", "state"},
),
SchedulePeriodicDuration: promauto.With(r).NewHistogram(
prometheus.HistogramOpts{