-
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
types: fix alert merging #1611
types: fix alert merging #1611
Conversation
a84b129
to
f3eff56
Compare
Just a high level question. I need to give this further thoughts.
How can the EndsAt ever be empty with: Lines 448 to 451 in 625604d
Wouldn't it rather be:
|
I don't see #1553 (v0.16.0) happening in the short term. Do you think we should cut a patch release for the previous v0.15.x series? |
I meant to say: alert merging assumed that firing alerts received from Prometheus would always have empty Although the problem is more acute for setups with short |
Res: &Alert{ | ||
Alert: model.Alert{ | ||
StartsAt: now.Add(-2 * time.Minute), | ||
EndsAt: now, |
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.
I am confused by this. If I have two alerts, where one is firing and one is not, I expect the merged alert to still be firing, right? Especially as none of them have the Timeout flag set.
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.
Because B is received after A, it's EndsAt value "wins" because A isn't resolved (is what I'm reading from the code and comments).
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.
Because B is received after A
Exactly, an alert that is effectively resolved wins over an older alert that was firing previously.
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.
Right got it. Thanks for clarifying @stuartnelson3 & @simonpasquier!
Res: &Alert{ | ||
Alert: model.Alert{ | ||
StartsAt: now.Add(-2 * time.Minute), | ||
EndsAt: now, |
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.
Right got it. Thanks for clarifying @stuartnelson3 & @simonpasquier!
Should we merge this first into |
Sounds fine to me |
@simonpasquier would you mind rebasing your one commit on top of release-0.15 branch? |
Alert merging assumed that EndsAt would always be empty for firing alerts. This is no longer true starting with Prometheus v2.4.0: EndsAt is set to a multiple of the evaluation interval or resend interval (whichever is the largest). This change updates the merging logic to support both cases. Signed-off-by: Simon Pasquier <spasquie@redhat.com>
f3eff56
to
b335096
Compare
PR rebased on top of |
Will follow up with a CHANGELOG pull request in a bit. |
@simonpasquier would you mind following up with a PR for this test? |
Alert merging assumed that EndsAt would always be empty for firing alerts. This is no longer true starting with Prometheus v2.4.0: EndsAt is set to a multiple of the evaluation interval or resend interval (whichever is the largest). See prometheus/prometheus#4550
The issue might be in #1581 and it has been raised on the prometheus users mailing list too.
I've added more tests because even though the code change is small, it is quite tricky to get it right (and I'm not sure I did!).
cc @brian-brazil @stuartnelson3 @mxinden