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 <abhilashgnan@gmail.com>

Fixes #19768

(cherry picked from commit 7f702f881c)
This commit is contained in:
Abhilash Gnan
2019-10-16 12:32:09 +03:00
committed by Sofia Papagiannaki
parent 90fe6c5a9f
commit af364fb91d
+4 -2
View File
@@ -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
}