Merged
Conversation
7ef9aa2 to
0f017d9
Compare
0f017d9 to
a1e73e3
Compare
Member
Author
|
The output of 2024-05-17T10:05:49.375+0200 INFO incident Rule reached escalation {"object": "icinga-2!ping4", "incident": "#12", "rule": "default", "escalation": {"id": 1, "rule_id": 1, "name": "[S] Working Hours, [C] Yonas Habteab", "condition": "incident_severity>=ok"}} |
julianbrost
requested changes
May 17, 2024
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.
a1e73e3 to
f482e1a
Compare
…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.
Otherwise, we will have a cyclic import error with the upcoming changes to non-state event processing support. It 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`.
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>
f482e1a to
28704ee
Compare
julianbrost
approved these changes
May 17, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR proposes the following improvements in preparation for #188.
contactChannelsfrom theincidentpackage, since we're going to use this recipient channels map elsewhere outside theincidentpackage in the future and it seems reasonable to me to move it here to therulepackage.zapcore.ObjectMarshalerfor therule.Escalationandrecipient.Keytypes and allows us to usezap.Inline(escalation)orzap.Object("escalation", escalation)wherever more logging context is needed without having to add all the individual fields ourselves each time.ErrSuperfluousStateChangeerror type to theeventpackage in order to mitigate a cyclic import error with the upcoming changes to non-state event processing support. It kind of also fit into this package.incident#AddHistory()method as it was already quite annoying having to returntypes.Intevery single time this method was used. This commit embeds the functionality forinsert and fetch IDdirectly into theHistoryRowtype and nowhere needs to be returned.createparam fromincident#ProcessEvent()andincident#GetCurrent(), since we can easily determine whether an incident is new based on itsStartedAttimestamp, and thus, we don't need to pass this info around methods. (Added @sukhwinder33445 as a co-author as the original idea was from him, but I've implemented it in a slightly different way).