Changes alertmanager_notifications to count attempted notifications (#1578)

alertmanager_notifications_total is increased only on
successful notifications, and not on any attempted
notification as the current description points

Signed-off-by: Chris Mark <chrismarkou92@gmail.com>
This commit is contained in:
Chris Mark 2018-10-09 15:23:12 +03:00 committed by Brian Brazil
parent 50b87ac720
commit 6eaacfe243

View File

@ -663,6 +663,7 @@ func (r RetryStage) Exec(ctx context.Context, l log.Logger, alerts ...*types.Ale
now := time.Now()
retry, err := r.integration.Notify(ctx, sent...)
notificationLatencySeconds.WithLabelValues(r.integration.name).Observe(time.Since(now).Seconds())
numNotifications.WithLabelValues(r.integration.name).Inc()
if err != nil {
numFailedNotifications.WithLabelValues(r.integration.name).Inc()
level.Debug(l).Log("msg", "Notify attempt failed", "attempt", i, "integration", r.integration.name, "receiver", r.groupName, "err", err)
@ -674,7 +675,6 @@ func (r RetryStage) Exec(ctx context.Context, l log.Logger, alerts ...*types.Ale
// integration upon context timeout.
iErr = err
} else {
numNotifications.WithLabelValues(r.integration.name).Inc()
return ctx, alerts, nil
}
case <-ctx.Done():