marker

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithContext

func WithContext(ctx context.Context, m AlertMarker) context.Context

WithContext returns a copy of ctx carrying the given AlertMarker. Inhibitor and Silencer extract it from the context to write per-group alert status.

Types

type AlertMarker

type AlertMarker interface {
	// SetInhibited sets the inhibitedBy for the given fingerprint.
	// If inhibitedBy is empty, it clears the inhibitedBy.
	SetInhibited(fingerprint model.Fingerprint, inhibitedBy []string)

	// SetSilenced sets the silencedBy for the given fingerprint.
	// If silencedBy is empty, it clears the silencedBy.
	SetSilenced(fingerprint model.Fingerprint, silencedBy []string)

	// Status returns the AlertStatus for the given fingerprint.
	// If the fingerprint is not found, it returns an unknown status.
	Status(fingerprint model.Fingerprint) alert.AlertStatus

	// Delete removes markers for the given fingerprints.
	Delete(fingerprints ...model.Fingerprint)
}

AlertMarker tracks per-alert silenced/inhibited status within a single aggregation group. Each aggregation group owns its own instance. All methods are goroutine-safe.

func FromContext

func FromContext(ctx context.Context) (AlertMarker, bool)

FromContext extracts the AlertMarker from ctx. If no marker is present, it returns (nil, false).

func NewAlertMarker

func NewAlertMarker() AlertMarker

NewAlertMarker returns a new AlertMarker backed by an in-memory map.

type GroupMarker

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.

func NewGroupMarker

func NewGroupMarker() GroupMarker

NewGroupMarker returns an instance of a GroupMarker implementation.

Jump to

Keyboard shortcuts

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