@@ -288,7 +288,7 @@ func NewMetrics(r prometheus.Registerer, ff featurecontrol.Flagger) *Metrics {
288
288
numNotificationSuppressedTotal : prometheus .NewCounterVec (prometheus.CounterOpts {
289
289
Namespace : "alertmanager" ,
290
290
Name : "notifications_suppressed_total" ,
291
- Help : "The total number of notifications suppressed for being outside of active time intervals or within muted time intervals." ,
291
+ Help : "The total number of notifications suppressed for being silenced, inhibited, outside of active time intervals or within muted time intervals." ,
292
292
}, []string {"reason" }),
293
293
notificationLatencySeconds : prometheus .NewHistogramVec (prometheus.HistogramOpts {
294
294
Namespace : "alertmanager" ,
@@ -514,10 +514,10 @@ func (n *GossipSettleStage) Exec(ctx context.Context, _ log.Logger, alerts ...*t
514
514
}
515
515
516
516
const (
517
- suppressedReasonSilence = "silence"
518
- suppressedReasonInhibition = "inhibition"
519
- suppressedReasonMuteTimeInterval = "mute_time_interval"
520
- suppressedReasonActiveTimeInterval = "active_time_interval"
517
+ SuppressedReasonSilence = "silence"
518
+ SuppressedReasonInhibition = "inhibition"
519
+ SuppressedReasonMuteTimeInterval = "mute_time_interval"
520
+ SuppressedReasonActiveTimeInterval = "active_time_interval"
521
521
)
522
522
523
523
// MuteStage filters alerts through a Muter.
@@ -548,17 +548,17 @@ func (n *MuteStage) Exec(ctx context.Context, logger log.Logger, alerts ...*type
548
548
// TODO(fabxc): increment muted alerts counter if muted.
549
549
}
550
550
if len (muted ) > 0 {
551
- level .Debug (logger ).Log ("msg" , "Notifications will not be sent for muted alerts" , "alerts" , fmt .Sprintf ("%v" , muted ))
552
551
553
552
var reason string
554
553
switch n .muter .(type ) {
555
554
case * silence.Silencer :
556
- reason = suppressedReasonSilence
555
+ reason = SuppressedReasonSilence
557
556
case * inhibit.Inhibitor :
558
- reason = suppressedReasonInhibition
557
+ reason = SuppressedReasonInhibition
559
558
default :
560
559
}
561
560
n .metrics .numNotificationSuppressedTotal .WithLabelValues (reason ).Add (float64 (len (muted )))
561
+ level .Debug (logger ).Log ("msg" , "Notifications will not be sent for muted alerts" , "alerts" , fmt .Sprintf ("%v" , muted ), "reason" , reason )
562
562
}
563
563
564
564
return ctx , filtered , nil
@@ -953,7 +953,7 @@ func (tms TimeMuteStage) Exec(ctx context.Context, l log.Logger, alerts ...*type
953
953
954
954
// If the current time is inside a mute time, all alerts are removed from the pipeline.
955
955
if muted {
956
- tms .metrics .numNotificationSuppressedTotal .WithLabelValues (suppressedReasonMuteTimeInterval ).Add (float64 (len (alerts )))
956
+ tms .metrics .numNotificationSuppressedTotal .WithLabelValues (SuppressedReasonMuteTimeInterval ).Add (float64 (len (alerts )))
957
957
level .Debug (l ).Log ("msg" , "Notifications not sent, route is within mute time" , "alerts" , len (alerts ))
958
958
return ctx , nil , nil
959
959
}
@@ -991,7 +991,7 @@ func (tas TimeActiveStage) Exec(ctx context.Context, l log.Logger, alerts ...*ty
991
991
992
992
// If the current time is not inside an active time, all alerts are removed from the pipeline
993
993
if ! muted {
994
- tas .metrics .numNotificationSuppressedTotal .WithLabelValues (suppressedReasonActiveTimeInterval ).Add (float64 (len (alerts )))
994
+ tas .metrics .numNotificationSuppressedTotal .WithLabelValues (SuppressedReasonActiveTimeInterval ).Add (float64 (len (alerts )))
995
995
level .Debug (l ).Log ("msg" , "Notifications not sent, route is not within active time" , "alerts" , len (alerts ))
996
996
return ctx , nil , nil
997
997
}
0 commit comments