-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix notifications for flapping alerts #1071
Conversation
if !r.integration.conf.SendResolved() { | ||
firing, ok := FiringAlerts(ctx) | ||
if !ok { | ||
return ctx, alerts, fmt.Errorf("firing alerts missing") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we error out here the MultiStage
will abort the further execution, therefore the resolved subset of this set of alerts will not be gossiped. My understanding is that if there are no firing alerts in this set of alerts, but there are resolved alerts, we still want to gossip that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. OTOH isn't this the same thing we are doing here? https://github.com/prometheus/alertmanager/blob/master/notify/notify.go#L627
AFAICS if this errors it means there's a bug in the code that should be fixed, as the context key should always be set earlier in the pipeline?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're absolutely right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. For anyone looking at the code, the logic for filtering resolved alerts is handled at https://github.com/prometheus/alertmanager/blob/master/notify/impl.go#L73-L81
Fixes #1063