-
Notifications
You must be signed in to change notification settings - Fork 1
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
Code enhancements for future use #198
Merged
Merged
Conversation
This file contains 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
yhabteab
force-pushed
the
future-use-preparation
branch
from
May 16, 2024 15:26
7ef9aa2
to
0f017d9
Compare
yhabteab
force-pushed
the
future-use-preparation
branch
from
May 17, 2024 08:07
0f017d9
to
a1e73e3
Compare
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.
yhabteab
force-pushed
the
future-use-preparation
branch
from
May 17, 2024 09:19
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>
yhabteab
force-pushed
the
future-use-preparation
branch
from
May 17, 2024 10:35
f482e1a
to
28704ee
Compare
julianbrost
approved these changes
May 17, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
contactChannels
from theincident
package, since we're going to use this recipient channels map elsewhere outside theincident
package in the future and it seems reasonable to me to move it here to therule
package.zapcore.ObjectMarshaler
for therule.Escalation
andrecipient.Key
types 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.ErrSuperfluousStateChange
error type to theevent
package 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.Int
every single time this method was used. This commit embeds the functionality forinsert and fetch ID
directly into theHistoryRow
type and nowhere needs to be returned.create
param fromincident#ProcessEvent()
andincident#GetCurrent()
, since we can easily determine whether an incident is new based on itsStartedAt
timestamp, 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).