types

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Alerts

func Alerts(alerts ...*Alert) model.Alerts

Alerts turns a sequence of internal alerts into a list of exposable model.Alert structures.

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.

func (*Alert) Merge

func (a *Alert) Merge(o *Alert) *Alert

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.

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.

func NewMarker

func NewMarker() Marker

NewMarker returns an instance of a Marker implementation.

type Matcher

type Matcher struct {
	Name  model.LabelName
	Value string
	// contains filtered or unexported fields
}

Matcher defines a matching rule for the value of a given label.

func NewMatcher

func NewMatcher(name model.LabelName, value string) *Matcher

NewMatcher returns a new matcher that compares against equality of the given value.

func NewRegexMatcher

func NewRegexMatcher(name model.LabelName, re *regexp.Regexp) *Matcher

NewRegexMatcher returns a new matcher that treats value as a regular expression which is used for matching.

func (*Matcher) IsRegex

func (m *Matcher) IsRegex() bool

IsRegex returns true of the matcher compares against a regular expression.

func (*Matcher) MarshalJSON

func (m *Matcher) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*Matcher) Match

func (m *Matcher) Match(lset model.LabelSet) bool

Match checks whether the label of the matcher has the specified matching value.

func (*Matcher) String

func (m *Matcher) String() string

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.

func (Matchers) Match

func (ms Matchers) Match(lset model.LabelSet) bool

Match checks whether all matchers are fulfilled against the given label set.

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) Add

func (e *MultiError) Add(err error)

Add adds an error to the MultiError.

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 MuteFunc

type MuteFunc func(model.LabelSet) bool

A MuteFunc is a function that implements the Muter interface.

func (MuteFunc) Mutes

func (f MuteFunc) Mutes(lset model.LabelSet) bool

Mutes implements the Muter interface.

type Muter

type Muter interface {
	Mutes(model.LabelSet) bool
}

A Muter determines whether a given label set is muted.

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

func NewSilence(s *model.Silence) *Silence

NewSilence creates a new internal Silence from a public silence object.

func (*Silence) Mutes

func (sil *Silence) Mutes(lset model.LabelSet) bool

Mutes implements the Muter interface.

Jump to

Keyboard shortcuts

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