Documentation
¶
Index ¶
- Variables
- func Alerts(alerts ...*Alert) model.Alerts
- func ByCreatedAt(i, j *Silence) bool
- func ByEndsAt(i, j *Silence) bool
- func ByStartsAt(i, j *Silence) bool
- type Alert
- type AlertSlice
- type Marker
- type Matcher
- type Matchers
- type MultiError
- type MuteFunc
- type Muter
- type NotifyInfo
- type Silence
- type SilencesLessFunc
- type SilencesQueryResponse
- type SilencesSorter
- type SortKey
Constants ¶
This section is empty.
Variables ¶
var (
ErrRequestExceedsAvailable = errors.New("requested offset surpasses total number of resource")
)
var SilenceLessFuncs = map[SortKey]SilencesLessFunc{ // contains filtered or unexported fields }
SilenceLessFuncs provides a typesafe way to take user input and select a SilencesLessFunc.
Functions ¶
func Alerts ¶
Alerts turns a sequence of internal alerts into a list of exposable model.Alert structures.
func ByCreatedAt ¶ added in v0.4.1
ByCreatedAt sorts compares CreatedAt times for silences.
func ByStartsAt ¶ added in v0.4.1
ByStartsAt sorts compares StartsAt times for silences.
Types ¶
type Alert ¶
type Alert struct {
model.Alert
// The authoritative timestamp.
UpdatedAt time.Time
Timeout bool
WasSilenced bool `json:"-"`
WasInhibited bool `json:"-"`
}
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.
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) Swap ¶
func (as AlertSlice) Swap(i, j int)
type Marker ¶
type Marker interface {
SetInhibited(alert model.Fingerprint, b bool)
SetSilenced(alert model.Fingerprint, sil ...uint64)
Silenced(alert model.Fingerprint) (uint64, bool)
Inhibited(alert model.Fingerprint) bool
}
Marker helps to mark alerts as silenced and/or inhibited. All methods are goroutine-safe.
type Matcher ¶
Matcher defines a matching rule for the value of a given label.
func NewMatcher ¶
NewMatcher returns a new matcher that compares against equality of the given value.
func NewRegexMatcher ¶
NewRegexMatcher returns a new matcher that treats value as a regular expression which is used for matching.
func (*Matcher) IsRegex ¶
IsRegex returns true of the matcher compares against a regular expression.
func (*Matcher) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
type Matchers ¶
type Matchers []*Matcher
Matchers provides the Match and Fingerprint methods for a slice of Matchers.
func (Matchers) Fingerprint ¶
func (ms Matchers) Fingerprint() model.Fingerprint
Fingerprint returns a quasi-unique fingerprint for the matchers.
type MultiError ¶
type MultiError struct {
// contains filtered or unexported fields
}
MultiError contains multiple errors and implements the error interface. Its zero value is ready to use. All its methods are goroutine safe.
func (*MultiError) Error ¶
func (e *MultiError) Error() string
func (*MultiError) Errors ¶
func (e *MultiError) Errors() []error
Errors returns the errors added to the MuliError. The returned slice is a copy of the internal slice of errors.
func (*MultiError) Len ¶
func (e *MultiError) Len() int
Len returns the number of errors added to the MultiError.
type NotifyInfo ¶
type NotifyInfo struct {
Alert model.Fingerprint
Receiver string
Resolved bool
Timestamp time.Time
}
NotifyInfo holds information about the last successful notification of an alert to a receiver.
func (*NotifyInfo) Fingerprint ¶
func (n *NotifyInfo) Fingerprint() model.Fingerprint
Fingerprint returns a quasi-unique fingerprint for the NotifyInfo.
func (*NotifyInfo) String ¶
func (n *NotifyInfo) String() string
type Silence ¶
type Silence struct {
model.Silence
// A set of matchers determining if an alert is affected
// by the silence.
Matchers Matchers `json:"-"`
// contains filtered or unexported fields
}
A Silence determines whether a given label set is muted at the current time.
func NewSilence ¶
NewSilence creates a new internal Silence from a public silence object.
type SilencesLessFunc ¶ added in v0.4.1
type SilencesQueryResponse ¶ added in v0.4.0
type SilencesQueryResponse struct {
// Silences returned by query.
Silences []*Silence `json:"silences"`
// Total silences.
TotalSilences int `json:"totalSilences"`
}
SilencesQueryResponse is the data structure returned from the Query method.
type SilencesSorter ¶ added in v0.4.1
type SilencesSorter struct {
// contains filtered or unexported fields
}
SilencesSorter implements the sort interface to sort a slice of silences according to less.
func NewSilencesSorter ¶ added in v0.4.1
func NewSilencesSorter(s []*Silence, fn SilencesLessFunc) *SilencesSorter
NewSilencesSorter returns a new SilencesSorter.
func (SilencesSorter) Len ¶ added in v0.4.1
func (ss SilencesSorter) Len() int
func (SilencesSorter) Less ¶ added in v0.4.1
func (ss SilencesSorter) Less(i, j int) bool
func (SilencesSorter) Swap ¶ added in v0.4.1
func (ss SilencesSorter) Swap(i, j int)