Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Alerts ¶
Alerts turns a sequence of internal alerts into a list of exposable model.Alert structures.
func Validate ¶ added in v0.35.0
Validate checks a model.Alert like model.Alert.Validate, but validates label names according to the matcher compatibility mode selected by the feature flags: classic mode rejects UTF-8 names, the other modes allow them. model.Alert.Validate follows the deprecated process-wide model.NameValidationScheme instead, which Alertmanager does not set.
Types ¶
type Alert ¶
type Alert struct {
model.Alert
// The authoritative timestamp.
UpdatedAt time.Time
Timeout bool
// contains filtered or unexported fields
}
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 New ¶ added in v0.35.0
New returns an Alert wrapping the given model.Alert. All Alerts must be created through New so that derived internal state can be computed here. The labels must not be modified afterwards.
func (*Alert) Fingerprint ¶ added in v0.35.0
func (a *Alert) Fingerprint() model.Fingerprint
Fingerprint returns the fingerprint of the alert's labels, computed at construction time.
func (*Alert) LabelSet ¶ added in v0.35.0
LabelSet returns the alert's labels together with its fingerprint, so that consumers which only need the labels do not hash them again.
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.
func (AlertState) Compare ¶ added in v0.33.0
func (s AlertState) Compare(other AlertState) int
Compare returns -1 if s has lower priority than other, 0 if equal, and 1 if higher. Priority order: suppressed > active > unprocessed.
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.)