From 7f702f881cf0770347769accedec6255811899b1 Mon Sep 17 00:00:00 2001 From: Abhilash Gnan Date: Wed, 16 Oct 2019 09:55:51 +0200 Subject: [PATCH] Alerting: All notification channels should always send (#19807) Fixes so that all notification channels configured for an alert should try to send notification even if one notification channel fails to send a notification. Signed-off-by: Abhilash Gnan Fixes #19768 --- pkg/services/alerting/notifier.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/services/alerting/notifier.go b/pkg/services/alerting/notifier.go index baec212fc6e..4f2946a3f71 100644 --- a/pkg/services/alerting/notifier.go +++ b/pkg/services/alerting/notifier.go @@ -37,6 +37,7 @@ type notificationService struct { func (n *notificationService) SendIfNeeded(context *EvalContext) error { notifierStates, err := n.getNeededNotifiers(context.Rule.OrgID, context.Rule.Notifications, context) if err != nil { + n.log.Error("Failed to get alert notifiers", "error", err) return err } @@ -109,10 +110,11 @@ func (n *notificationService) sendNotifications(evalContext *EvalContext, notifi err := n.sendNotification(evalContext, notifierState) if err != nil { n.log.Error("failed to send notification", "uid", notifierState.notifier.GetNotifierUID(), "error", err) - return err + if evalContext.IsTestRun { + return err + } } } - return nil }