Documentation ¶
Index ¶
Constants ¶
const DEFAULT_TIMEOUT_INTERVAL = 12 * time.Hour
DEFAULT_TIMEOUT_INTERVAL is the length of time after first seeing an alert that we time out the alert if we haven't seen any other information about it.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct { // ID is the unique ID of the alert. ID string `json:"id,omitempty"` // Labels defines the metadata on the alert that is used for deduplication purposes. Labels Labels `json:"labels"` // Annotations defines them metadata on the alert that _isn't_ used for deduplication. This can be links etc. Annotations map[string]string `json:"annotations"` // Status is the status of the alert in the system. Status AlertStatus `json:"status"` // Acknowledgement is the details if this alert has fired and been acknowledged. Acknowledgement *AlertAcknowledgement `json:"acknowledgement,omitempty"` // StartTime is when the alert first started firing. StartTime time.Time `json:"startsAt"` // EndTime is when the alert ended (either timed out or resolved). EndTime time.Time `json:"endsAt"` // TimeOutDeadline is when the alert should be marked as timed out, assuming no further messages come in. TimeOutDeadline time.Time `json:"timeOutDeadline,omitempty"` // LastNotifyTime is the time that a notification for this alert was last sent. LastNotifyTime time.Time `json:"-"` }
Alert is the _operational state_ of the alert. As opposed to the protobuf structs that are the values being transmitted, this struct contains all the state that might be ascertained by Kiora through interactions with other models (e.g. silences).
func (*Alert) Acknowledge ¶
func (a *Alert) Acknowledge(ack *AlertAcknowledgement) error
Acknowledge marks this alert as Acknowledged with the given metadata.
func (*Alert) Materialise ¶
Materialise fills in any missing fields in the alert with sensible defaults.
func (*Alert) UnmarshalJSON ¶
type AlertAcknowledgement ¶
type AlertAcknowledgement struct { Creator string `json:"creator"` Comment string `json:"comment"` }
AlertAcknowledgement is the metadata provided when an operator acknowledges an alert.
func (*AlertAcknowledgement) Fields ¶
func (a *AlertAcknowledgement) Fields() map[string]any
type AlertStatus ¶
type AlertStatus string
AlertStatus is the current status of an alert in Kiora.
const ( // AlertStatusFiring marks alerts that are currently active. AlertStatusFiring AlertStatus = "firing" // AlertStatusAcked marks alerts that are firing, but have been acknowledged by a human. AlertStatusAcked AlertStatus = "acked" // AlertStatusResolved marks alerts that were firing but have now been resolved. AlertStatusResolved AlertStatus = "resolved" // AlertStatusTimedOut marks alerts that we never got a resolved notification for, but hit their expiry times. AlertStatusTimedOut AlertStatus = "timed out" // AlertStatusSilenced marks alerts that have been silenced by one or more silences. AlertStatusSilenced AlertStatus = "silenced" )
type Labels ¶
Labels is a utility type encapsulating a map[string]string that can be hashed.
func (Labels) Hash ¶
func (s Labels) Hash() LabelsHash
Hash takes an xxhash64 across all the labels in the map.
type LabelsHash ¶
type LabelsHash = uint64
type Matcher ¶
type Matcher struct { Label string `json:"label"` Value string `json:"value"` IsRegex bool `json:"isRegex"` IsNegative bool `json:"isNegative"` // contains filtered or unexported fields }
func LabelValueEqualMatcher ¶
func LabelValueRegexMatcher ¶
func (*Matcher) UnmarshalJSON ¶
func (*Matcher) UnmarshalText ¶
type Silence ¶
type Silence struct { // ID is the unique identifier of the silence. ID string `json:"id"` // By is the user that created the silence. Creator string `json:"creator"` // Comment is a comment about the silence. Comment string `json:"comment"` // StartTime is the time at which the silence starts. StartTime time.Time `json:"startsAt"` // EndTime is the time at which the silence ends. EndTime time.Time `json:"endsAt"` // Matchers is a list of matchers that must all match an alert for it to be silenced. Matchers []Matcher `json:"matchers"` }