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
Support sending non-state notifications without an incident #188
base: main
Are you sure you want to change the base?
Conversation
0431265
to
62d1ceb
Compare
796ff00
to
0ff79aa
Compare
c2743ba
to
8ba8889
Compare
b7dd933
to
68811f7
Compare
Please review concept and functionality, but be aware that there is no corresponding web PR yet. |
8c380a1
to
e2269d2
Compare
We don't need to pass this info around methods since we can easily determine whether an incident is new based on its `StartedAt` timestamp. Co-Authored-By: Sukhwinder Dhillon <sukhwinder.dhillon@icinga.com>
We're going to use this recipient channels map elsewhere outside the `incident` package in the future and it seems reasonable to me to move it here to the `rule` package.
In the upcoming commits, this will also be used elsewhere.
In the upcoming commits, this will also be used elsewhere.
…t.Key` This allows us to use `zap.Inline(escalation)` or `zap.Object("escalation", escalation)`wherever more logging context is needed without having to add all the individual fields ourselves each time.
It will be used to determine non-state notification recipients without an incident.
Given that these configs are user-configurable, they need to be loaded regulary from the database just like the other types. I have also already taken careful consideration to deduplicate as much code as possible.
…ror type Otherwise, we will have a cyclic import error with the upcoming changes to non-state event processing support. They kind of also fit into this package.
It was already quite annoying having to return `types.Int` every single time this method was used. This commit embeds the functionality for `insert and fetch ID` directly into the `HistoryRow` type and nowhere needs to be returned. The just inserted and fetched ID can be accessed with `history.ID`.
I also replaced `errors` with `github/pkg/errors` package, is it was quite challenging to track down the errors, as we only get messages without stack traces with the standard errors package.
The `incident_event` table is now obsolete and is no longer required, and the `incident#ProcessEvent()` method has been replaced by the new `events.Router` type.
Co-Authored-By: Sukhwinder Dhillon <sukhwinder.dhillon@icinga.com>
68811f7
to
11b142c
Compare
if i != nil { | ||
if err := i.ProcessEvent(ctx, ev); err != nil { | ||
if errors.Is(err, event.ErrSuperfluousStateChange) { | ||
return err | ||
} | ||
|
||
// Expect the actual error to be logged with additional context in the incident package. | ||
return event.ErrEventProcessing | ||
} | ||
|
||
return nil | ||
} |
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.
So if an Incident exists, the other rules aren't even considered? That shouldn't be the case, if you configure that you want to be notified about downtimes, you should be notified about all of them.
Facilitates sending non-state notifications even without an active incident. See the individual commits separately for the details of why something was changed and most of them also contain their own reasons.
resolves #106
closes #137