alerting

package
v1.32.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0, MIT Imports: 6 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	Type   AlertType
	Active bool

	LastActive   *AlertEvent // NOTE: pointer for nullability, don't mutate the referenced object!
	LastResolved *AlertEvent
	// contains filtered or unexported fields
}

type AlertEvent

type AlertEvent struct {
	Type    string // either 'raised' or 'resolved'
	Message json.RawMessage
	Time    time.Time
}

AlertEvent contains information about alert state transition

type AlertType

type AlertType struct {
	System, Subsystem string
}

AlertType is a unique alert identifier

type Alerting

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

Alerting provides simple stateful alert system. Consumers can register alerts, which can be raised and resolved.

When an alert is raised or resolved, a related journal entry is recorded.

func NewAlertingSystem

func NewAlertingSystem(j journal.Journal) *Alerting

func (*Alerting) AddAlertType

func (a *Alerting) AddAlertType(system, subsystem string) AlertType

func (*Alerting) GetAlerts

func (a *Alerting) GetAlerts() []Alert

GetAlerts returns all registered (active and inactive) alerts

func (*Alerting) IsRaised added in v1.17.1

func (a *Alerting) IsRaised(at AlertType) bool

func (*Alerting) Raise

func (a *Alerting) Raise(at AlertType, message interface{})

Raise marks the alert condition as active and records related event in the journal

func (*Alerting) Resolve

func (a *Alerting) Resolve(at AlertType, message interface{})

Resolve marks the alert condition as resolved and records related event in the journal

Jump to

Keyboard shortcuts

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