From f5cfe0b4e8a9ba9ddb8eaf53ab896503b7f00cfe Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Wed, 30 Sep 2015 18:44:33 +0200 Subject: [PATCH] Add an exit point in case all alerts are filtered --- notify/notify.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/notify/notify.go b/notify/notify.go index 3ccc2252..728d796a 100644 --- a/notify/notify.go +++ b/notify/notify.go @@ -128,6 +128,12 @@ func (n *DedupingNotifier) Notify(ctx context.Context, alerts ...*types.Alert) e }) } + // The deduping notifier is the last one before actually sending notifications. + // Thus, this is the place where we abort if after all filtering, nothing is left. + if len(filtered) == 0 { + return nil + } + if err := n.notifier.Notify(ctx, filtered...); err != nil { return err }