types

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: 4 Imported by: 849

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Alerts = alert.Alerts

Deprecated: Use alert.Alerts directly.

Functions

This section is empty.

Types

type Alert deprecated

type Alert = alert.Alert

Deprecated: Use alert.Alert directly.

type AlertMarker added in v0.28.0

type AlertMarker interface {
	// SetActiveOrSilenced replaces the previous SilencedBy by the provided IDs of
	// active silences. The set of provided IDs is supposed to represent the
	// complete set of relevant silences. If no active silence IDs are provided and
	// InhibitedBy is already empty, it sets the provided alert to AlertStateActive.
	// Otherwise, it sets the provided alert to AlertStateSuppressed.
	SetActiveOrSilenced(alert model.Fingerprint, activeSilenceIDs []string)
	// SetInhibited replaces the previous InhibitedBy by the provided IDs of
	// alerts. In contrast to SetActiveOrSilenced, the set of provided IDs is not
	// expected to represent the complete set of inhibiting alerts. (In
	// practice, this method is only called with one or zero IDs. However,
	// this expectation might change in the future. If no IDs are provided
	// and InhibitedBy is already empty, it sets the provided alert to
	// AlertStateActive. Otherwise, it sets the provided alert to
	// AlertStateSuppressed.
	SetInhibited(alert model.Fingerprint, alertIDs ...string)

	// Count alerts of the given state(s). With no state provided, count all
	// alerts.
	Count(...AlertState) int

	// Status of the given alert.
	Status(model.Fingerprint) AlertStatus
	// Delete the given alert.
	Delete(...model.Fingerprint)

	// Various methods to inquire if the given alert is in a certain
	// AlertState. Silenced also returns all the active silences,
	// while Inhibited may return only a subset of inhibiting alerts.
	Unprocessed(model.Fingerprint) bool
	Active(model.Fingerprint) bool
	Silenced(model.Fingerprint) (activeIDs []string, silenced bool)
	Inhibited(model.Fingerprint) ([]string, bool)
}

AlertMarker helps to mark alerts as silenced and/or inhibited. All methods are goroutine-safe.

type AlertSlice deprecated

type AlertSlice = alert.AlertSlice

Deprecated: Use alert.AlertSlice directly.

type AlertState deprecated added in v0.6.1

type AlertState = alert.AlertState

Deprecated: Use alert.AlertState constants directly.

const AlertStateActive AlertState = alert.AlertStateActive

Deprecated: Use alert.AlertStateActive directly.

const AlertStateSuppressed AlertState = alert.AlertStateSuppressed

Deprecated: Use alert.AlertStateSuppressed directly.

const AlertStateUnprocessed AlertState = alert.AlertStateUnprocessed

Deprecated: Use alert.AlertStateUnprocessed directly.

type AlertStatus deprecated added in v0.6.1

type AlertStatus = alert.AlertStatus

Deprecated: Use alert.AlertStatus directly.

type GroupMarker added in v0.28.0

type GroupMarker interface {
	// Muted returns true if the group is muted, otherwise false. If the group
	// is muted then it also returns the names of the time intervals that muted
	// it.
	Muted(routeID, groupKey string) ([]string, bool)

	// SetMuted marks the group as muted, and sets the names of the time
	// intervals that mute it. If the list of names is nil or the empty slice
	// then the muted marker is removed.
	SetMuted(routeID, groupKey string, timeIntervalNames []string)

	// DeleteByGroupKey removes all markers for the GroupKey.
	DeleteByGroupKey(routeID, groupKey string)
}

GroupMarker helps to mark groups as active or muted. All methods are goroutine-safe.

TODO(grobinson): routeID is used in Muted and SetMuted because groupKey is not unique (see #3817). Once groupKey uniqueness is fixed routeID can be removed from the GroupMarker interface.

type MemMarker added in v0.28.0

type MemMarker struct {
	// contains filtered or unexported fields
}

func NewMarker

func NewMarker(r prometheus.Registerer) *MemMarker

NewMarker returns an instance of a AlertMarker implementation.

func (*MemMarker) Active added in v0.28.0

func (m *MemMarker) Active(alert model.Fingerprint) bool

Active implements AlertMarker.

func (*MemMarker) Count added in v0.28.0

func (m *MemMarker) Count(states ...AlertState) int

Count implements AlertMarker.

func (*MemMarker) Delete added in v0.28.0

func (m *MemMarker) Delete(alerts ...model.Fingerprint)

Delete implements AlertMarker.

func (*MemMarker) DeleteByGroupKey added in v0.28.0

func (m *MemMarker) DeleteByGroupKey(routeID, groupKey string)

func (*MemMarker) Inhibited added in v0.28.0

func (m *MemMarker) Inhibited(alert model.Fingerprint) ([]string, bool)

Inhibited implements AlertMarker.

func (*MemMarker) Muted added in v0.28.0

func (m *MemMarker) Muted(routeID, groupKey string) ([]string, bool)

Muted implements GroupMarker.

func (*MemMarker) SetActiveOrSilenced added in v0.28.0

func (m *MemMarker) SetActiveOrSilenced(alert model.Fingerprint, activeIDs []string)

SetActiveOrSilenced implements AlertMarker.

func (*MemMarker) SetInhibited added in v0.28.0

func (m *MemMarker) SetInhibited(alert model.Fingerprint, ids ...string)

SetInhibited implements AlertMarker.

func (*MemMarker) SetMuted added in v0.28.0

func (m *MemMarker) SetMuted(routeID, groupKey string, timeIntervalNames []string)

SetMuted implements GroupMarker.

func (*MemMarker) Silenced added in v0.28.0

func (m *MemMarker) Silenced(alert model.Fingerprint) (activeIDs []string, silenced bool)

Silenced returns whether the alert for the given Fingerprint is in the Silenced state, any associated silence IDs, and the silences state version the result is based on.

func (*MemMarker) Status added in v0.28.0

func (m *MemMarker) Status(alert model.Fingerprint) AlertStatus

Status implements AlertMarker.

func (*MemMarker) Unprocessed added in v0.28.0

func (m *MemMarker) Unprocessed(alert model.Fingerprint) bool

Unprocessed implements AlertMarker.

Jump to

Keyboard shortcuts

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