alert

package
v0.32.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Alerts

func Alerts(alerts ...*Alert) model.Alerts

Alerts turns a sequence of internal alerts into a list of exposable model.Alert structures.

Types

type Alert

type Alert struct {
	model.Alert

	// The authoritative timestamp.
	UpdatedAt time.Time
	Timeout   bool
}

Alert wraps a model.Alert with additional information relevant to internal of the Alertmanager. The type is never exposed to external communication and the embedded alert has to be sanitized beforehand.

func (*Alert) Merge

func (a *Alert) Merge(o *Alert) *Alert

Merge merges the timespan of two alerts based and overwrites annotations based on the authoritative timestamp. A new alert is returned, the labels are assumed to be equal.

func (*Alert) Validate

func (a *Alert) Validate() error

Validate overrides the same method in model.Alert to allow UTF-8 labels. This can be removed once prometheus/common has support for UTF-8.

type AlertSlice

type AlertSlice []*Alert

AlertSlice is a sortable slice of Alerts.

func (AlertSlice) Len

func (as AlertSlice) Len() int

func (AlertSlice) Less

func (as AlertSlice) Less(i, j int) bool

func (AlertSlice) LogValue

func (as AlertSlice) LogValue() slog.Value

LogValue implements slog.LogValuer. It returns a summary of alert counts per alertname, e.g. "MyAlert: 3, OtherAlert: 1".

func (AlertSlice) Swap

func (as AlertSlice) Swap(i, j int)

type AlertState

type AlertState string

AlertState is used as part of AlertStatus.

const (
	AlertStateUnprocessed AlertState = "unprocessed"
	AlertStateActive      AlertState = "active"
	AlertStateSuppressed  AlertState = "suppressed"
)

Possible values for AlertState.

type AlertStatus

type AlertStatus struct {
	State       AlertState `json:"state"`
	SilencedBy  []string   `json:"silencedBy"`
	InhibitedBy []string   `json:"inhibitedBy"`
}

AlertStatus stores the state of an alert and, as applicable, the IDs of silences silencing the alert and of other alerts inhibiting the alert. Note that currently, SilencedBy is supposed to be the complete set of the relevant silences while InhibitedBy may contain only a subset of the inhibiting alerts – in practice exactly one ID. (This somewhat confusing semantics might change in the future.)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL