Closed yhabteab closed 4 months ago
The output of zap.Object("escalation", escalation)
looks as follows:
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"}}
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).