Skip to content
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

Merged
merged 1 commit into from
Nov 2, 2017

Conversation

juliusv
Copy link
Member

@juliusv juliusv commented Nov 1, 2017

Fixes #1063

@juliusv
Copy link
Member Author

juliusv commented Nov 1, 2017

@brancz @josedonizetti

if !r.integration.conf.SendResolved() {
firing, ok := FiringAlerts(ctx)
if !ok {
return ctx, alerts, fmt.Errorf("firing alerts missing")
Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're absolutely right.

Copy link
Member

@brancz brancz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 👍

Copy link
Contributor

@stuartnelson3 stuartnelson3 left a 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

@stuartnelson3 stuartnelson3 merged commit b0aab04 into master Nov 2, 2017
@stuartnelson3 stuartnelson3 deleted the fix-no-send-resolved-notifications branch November 2, 2017 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants