Commit 7f702f88 by Abhilash Gnan Committed by Marcus Efraimsson

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
parent 2e189302
...@@ -37,6 +37,7 @@ type notificationService struct { ...@@ -37,6 +37,7 @@ type notificationService struct {
func (n *notificationService) SendIfNeeded(context *EvalContext) error { func (n *notificationService) SendIfNeeded(context *EvalContext) error {
notifierStates, err := n.getNeededNotifiers(context.Rule.OrgID, context.Rule.Notifications, context) notifierStates, err := n.getNeededNotifiers(context.Rule.OrgID, context.Rule.Notifications, context)
if err != nil { if err != nil {
n.log.Error("Failed to get alert notifiers", "error", err)
return err return err
} }
...@@ -109,10 +110,11 @@ func (n *notificationService) sendNotifications(evalContext *EvalContext, notifi ...@@ -109,10 +110,11 @@ func (n *notificationService) sendNotifications(evalContext *EvalContext, notifi
err := n.sendNotification(evalContext, notifierState) err := n.sendNotification(evalContext, notifierState)
if err != nil { if err != nil {
n.log.Error("failed to send notification", "uid", notifierState.notifier.GetNotifierUID(), "error", err) n.log.Error("failed to send notification", "uid", notifierState.notifier.GetNotifierUID(), "error", err)
if evalContext.IsTestRun {
return err return err
} }
} }
}
return nil return nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment