@@ -23,6 +23,8 @@ type InhibitorMetrics struct {
2323 sourceAlertsCacheItems prometheus.Gauge
2424 sourceAlertsIndexItems prometheus.Gauge
2525 mutesDuration * prometheus.SummaryVec
26+ mutesDurationMuted prometheus.Observer
27+ mutesDurationNotMuted prometheus.Observer
2628
2729 // Rule metrics
2830 ruleSourceAlertsCacheItems * prometheus.GaugeVec
@@ -53,6 +55,7 @@ func NewInhibitorMetrics(reg prometheus.Registerer) *InhibitorMetrics {
5355 },
5456 []string {"muted" },
5557 ),
58+
5659 ruleSourceAlertsCacheItems : prometheus .NewGaugeVec (
5760 prometheus.GaugeOpts {
5861 Name : "alertmanager_inhibit_rule_source_alerts_cache_items" ,
@@ -82,6 +85,10 @@ func NewInhibitorMetrics(reg prometheus.Registerer) *InhibitorMetrics {
8285 []string {"rule" , "muted" },
8386 ),
8487 }
88+
89+ metrics .mutesDurationMuted = metrics .mutesDuration .With (prometheus.Labels {"muted" : "true" })
90+ metrics .mutesDurationNotMuted = metrics .mutesDuration .With (prometheus.Labels {"muted" : "false" })
91+
8592 if reg != nil {
8693 reg .MustRegister (
8794 metrics .sourceAlertsCacheItems ,
@@ -101,20 +108,26 @@ func NewInhibitorMetrics(reg prometheus.Registerer) *InhibitorMetrics {
101108}
102109
103110type RuleMetrics struct {
104- ruleName string
105- matchesDuration * prometheus.SummaryVec
106- mutesDuration * prometheus.SummaryVec
111+ ruleName string
112+ matchesDurationMatched prometheus.Observer
113+ matchesDurationNotMatched prometheus.Observer
114+
115+ mutesDurationMuted prometheus.Observer
116+ mutesDurationNotMuted prometheus.Observer
117+
107118 sourceAlertsCacheItems * prometheus.GaugeVec
108119 sourceAlertsIndexItems * prometheus.GaugeVec
109120}
110121
111122func NewRuleMetrics (name string , metrics * InhibitorMetrics ) * RuleMetrics {
112123 rm := & RuleMetrics {
113- ruleName : name ,
114- matchesDuration : metrics .ruleMatchesDuration ,
115- mutesDuration : metrics .ruleMutesDuration ,
116- sourceAlertsCacheItems : metrics .ruleSourceAlertsCacheItems ,
117- sourceAlertsIndexItems : metrics .ruleSourceAlertsIndexItems ,
124+ ruleName : name ,
125+ matchesDurationMatched : metrics .ruleMatchesDuration .With (prometheus.Labels {"rule" : name , "matched" : "true" }),
126+ matchesDurationNotMatched : metrics .ruleMatchesDuration .With (prometheus.Labels {"rule" : name , "matched" : "false" }),
127+ mutesDurationMuted : metrics .ruleMutesDuration .With (prometheus.Labels {"rule" : name , "muted" : "true" }),
128+ mutesDurationNotMuted : metrics .ruleMutesDuration .With (prometheus.Labels {"rule" : name , "muted" : "false" }),
129+ sourceAlertsCacheItems : metrics .ruleSourceAlertsCacheItems ,
130+ sourceAlertsIndexItems : metrics .ruleSourceAlertsIndexItems ,
118131 }
119132
120133 rm .sourceAlertsCacheItems .With (prometheus.Labels {"rule" : rm .ruleName }).Set (0 )
0 commit comments