Documentation ¶
Index ¶
- type Alert
- func (a *Alert) Clone() *Alert
- func (a *Alert) Fingerprint() label.Fingerprint
- func (a *Alert) Merge(o *Alert) *Alert
- func (a *Alert) Name() string
- func (a *Alert) Resolved() bool
- func (a *Alert) ResolvedAt(ts time.Time) bool
- func (a *Alert) Status() AlertStatus
- func (a *Alert) String() string
- func (a *Alert) Validate() error
- type AlertState
- type AlertStatus
- type Alerts
- type Marker
- type MarkerStatus
- type MuteFunc
- type Muter
- type SilenceState
- type SilenceStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct { // Label value pairs for purpose of aggregation, matching, and disposition // dispatching. This must minimally include an "alertname" label. Labels label.LabelSet `json:"labels"` // Extra key/value information which does not define alert identity. Annotations label.LabelSet `json:"annotations"` // The known time range for this alert. Both ends are optional. StartsAt time.Time `json:"startsAt,omitempty"` EndsAt time.Time `json:"endsAt,omitempty"` GeneratorURL string `json:"generatorURL"` // The authoritative timestamp. UpdatedAt time.Time Timeout bool }
Alert is a single alert. it is a copy of the Alert struct from the Alertmanager
func (*Alert) Fingerprint ¶
func (a *Alert) Fingerprint() label.Fingerprint
func (*Alert) Merge ¶
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) ResolvedAt ¶
ResolvedAt returns true if the activity interval ended before the given timestamp.
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 string
const ( AlertNone AlertStatus = "none" AlertFiring AlertStatus = "firing" AlertResolved AlertStatus = "resolved" )
func (AlertStatus) MarshalGQL ¶
func (a AlertStatus) MarshalGQL(w io.Writer)
func (*AlertStatus) UnmarshalGQL ¶
func (a *AlertStatus) UnmarshalGQL(v interface{}) error
func (AlertStatus) Values ¶
func (a AlertStatus) Values() []string
type Alerts ¶
type Alerts []*Alert
Alerts is a slice of alerts that implements sort.Interface.
func (Alerts) Status ¶
func (as Alerts) Status() AlertStatus
Status returns StatusFiring iff at least one of the alerts is firing.
type Marker ¶
type Marker interface { // SetActiveOrSilenced replaces the previous SilencedBy by the provided IDs of // active and pending silences, including the version number of the // silences state. 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 label.Fingerprint, version int, activeSilenceIDs, pendingSilenceIDs []int) // 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 label.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(label.Fingerprint) MarkerStatus // Delete the given alert. Delete(label.Fingerprint) // Various methods to inquire if the given alert is in a certain // AlertState. Silenced also returns all the active and pending // silences, while Inhibited may return only a subset of inhibiting // alerts. Silenced also returns the version of the silences state the // result is based on. Unprocessed(label.Fingerprint) bool Active(label.Fingerprint) bool Silenced(label.Fingerprint) (activeIDs, pendingIDs []int, version int, silenced bool) Inhibited(label.Fingerprint) ([]string, bool) }
Marker helps to mark alerts as silenced and/or inhibited. All methods are goroutine-safe.
func NewMarker ¶
func NewMarker(r prometheus.Registerer) Marker
NewMarker returns an instance of a Marker implementation.
type MarkerStatus ¶
type MarkerStatus struct { State AlertState `json:"state"` SilencedBy []int `json:"silencedBy"` InhibitedBy []string `json:"inhibitedBy"` // contains filtered or unexported fields }
MarkerStatus 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.)
type Muter ¶
A Muter determines whether a given label set is muted. Implementers that maintain an underlying Marker are expected to update it during a call of Mutes.
type SilenceState ¶
type SilenceState string
SilenceState is used as part of SilenceStatus.
const ( SilenceStateExpired SilenceState = "expired" SilenceStateActive SilenceState = "active" SilenceStatePending SilenceState = "pending" )
Possible values for SilenceState.
func CalcSilenceState ¶
func CalcSilenceState(start, end time.Time) SilenceState
CalcSilenceState returns the SilenceState that a silence with the given start and end time would have right now.
func (SilenceState) IsValid ¶
func (s SilenceState) IsValid() bool
func (SilenceState) MarshalGQL ¶
func (s SilenceState) MarshalGQL(w io.Writer)
func (*SilenceState) UnmarshalGQL ¶
func (s *SilenceState) UnmarshalGQL(v interface{}) error
func (SilenceState) Values ¶
func (s SilenceState) Values() []string
type SilenceStatus ¶
type SilenceStatus struct {
State SilenceState `json:"state"`
}
SilenceStatus stores the state of a silence.