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
This commit is contained in:
Abhilash Gnan 2019-10-16 09:55:51 +02:00 committed by Marcus Efraimsson
parent 2e18930285
commit 7f702f881c

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
}