-
Notifications
You must be signed in to change notification settings - Fork 581
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
Consult Checkable#state_before_suppression only if there's a suppression #10032
Consult Checkable#state_before_suppression only if there's a suppression #10032
Conversation
Test
Before: no recovery notification After: a recovery notification |
Can you please rebase this for up-to-date GitHub Actions checks? There are even failed runs where to logs were already purged so one can't tell if this was some kind of transient error or actually something being broken by this PR. |
It's only set along with adding NotificationProblem or NotificationRecovery to Checkable#suppressed_notifications and never reset. Also its default, ServiceOK, is an actual state. Not being aware of these facts confuses Checkable#NotificationReasonApplies() which is a condition for cleaning Notification#suppressed_notifications in FireSuppressedNotifications(). I.e. suppressed notifications can get lost.
e18b15a
to
cafbe5e
Compare
The longer I look at the code, the more I think For easy reference, the relevant code places from the current icinga2/lib/icinga/checkable-notification.cpp Lines 256 to 284 in a8adfed
icinga2/lib/icinga/checkable-notification.cpp Lines 182 to 211 in a8adfed
Now look at the Now the following idea: -if (NotificationReasonApplies(type)) {
+if (cr->GetState() != GetStateBeforeSuppression()) { That should move the check to where it's relevant, namely where a notification might actually be sent after the suppression ended. That would actually allow us to get pretty close to you suggested in #10025 (comment), i.e. the The other callers would have to be looked into as well. I believe the following one would have to be changed: icinga2/lib/notification/notificationcomponent.cpp Lines 86 to 91 in a8adfed
I think the What do you think of that idea? Footnotes
|
Why not? If a hard critical (suppressed += NotificationProblem) recovers within the same downtime (= suppression), why not to clean up (suppressed -= NotificationProblem) right away? Generally speaking, you asked why I stick to already existing solutions for a problem in unfavor of new ones. I don't. I stick to straightforward ones fixing that particular problem. (Like this PR.) Because the more you touch...
... the more likely you'll touch a running system where you didn't know you don't want to. Especially for a bugfix release! |
Because
This PR makes some condition more complex. The goal of my suggestion would be to remove complexity by moving the different parts of the checks to where they are relevant. One problem of
That sounds nice in theory, but in practice, also for your change, you have to verify how this affects the different callers. |
Looking at this with a bit more context around: icinga2/lib/notification/notificationcomponent.cpp Lines 79 to 91 in a8adfed
That place is actually related to
However, suppression on the For this PR specifically, this poses the question whether there can be situations where the condition |
It's only set along with adding NotificationProblem or NotificationRecovery to Checkable#suppressed_notifications and never reset. Also its default, ServiceOK, is an actual state. Not being aware of these facts confuses Checkable#NotificationReasonApplies() which is a condition for cleaning Notification#suppressed_notifications in FireSuppressedNotifications(). I.e. suppressed notifications can get lost.
fixes #10025