Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct { // The name of the alert. Name string // The vector element labelset triggering this alert. Labels model.LabelSet // The state of the alert (Pending or Firing). State AlertState // The time when the alert first transitioned into Pending state. ActiveSince model.Time // The value of the alert expression for this vector element. Value model.SampleValue }
Alert is used to track active (pending/firing) alerts over time.
type AlertState ¶
type AlertState int
AlertState denotes the state of an active alert.
const ( // StateInactive is the state of an alert that is either firing nor pending. StateInactive AlertState = iota // StatePending is the state of an alert that has been active for less than // the configured threshold duration. StatePending // StateFiring is the state of an alert that has been active for longer than // the configured threshold duration. StateFiring )
func (AlertState) String ¶
func (s AlertState) String() string
type AlertingRule ¶
type AlertingRule struct {
// contains filtered or unexported fields
}
An AlertingRule generates alerts from its vector expression.
func NewAlertingRule ¶
func NewAlertingRule( name string, vector promql.Expr, holdDuration time.Duration, labels model.LabelSet, summary string, description string, runbook string, ) *AlertingRule
NewAlertingRule constructs a new AlertingRule.
func (*AlertingRule) ActiveAlerts ¶
func (rule *AlertingRule) ActiveAlerts() []Alert
ActiveAlerts returns a slice of active alerts.
func (*AlertingRule) HTMLSnippet ¶
func (rule *AlertingRule) HTMLSnippet(pathPrefix string) template.HTML
HTMLSnippet returns an HTML snippet representing this alerting rule. The resulting snippet is expected to be presented in a <pre> element, so that line breaks and other returned whitespace is respected.
func (*AlertingRule) Name ¶
func (rule *AlertingRule) Name() string
Name returns the name of the alert.
func (*AlertingRule) State ¶
func (rule *AlertingRule) State() AlertState
State returns the "maximum" state: firing > pending > inactive.
func (*AlertingRule) String ¶
func (rule *AlertingRule) String() string
type Manager ¶
type Manager struct { // Protects the rules list. sync.Mutex // contains filtered or unexported fields }
The Manager manages recording and alerting rules.
func NewManager ¶
func NewManager(o *ManagerOptions) *Manager
NewManager returns an implementation of Manager, ready to be started by calling the Run method.
func (*Manager) AlertingRules ¶
func (m *Manager) AlertingRules() []*AlertingRule
AlertingRules returns the list of the manager's alerting rules.
func (*Manager) ApplyConfig ¶
ApplyConfig updates the rule manager's state as the config requires. If loading the new rules failed the old rule set is restored. Returns true on success.
type ManagerOptions ¶
type ManagerOptions struct { EvaluationInterval time.Duration QueryEngine *promql.Engine NotificationHandler *notification.NotificationHandler SampleAppender storage.SampleAppender ExternalURL *url.URL }
ManagerOptions bundles options for the Manager.
type RecordingRule ¶
type RecordingRule struct {
// contains filtered or unexported fields
}
A RecordingRule records its vector expression into new timeseries.
func NewRecordingRule ¶
NewRecordingRule returns a new recording rule.
func (RecordingRule) HTMLSnippet ¶
func (rule RecordingRule) HTMLSnippet(pathPrefix string) template.HTML
HTMLSnippet returns an HTML snippet representing this rule.
func (RecordingRule) String ¶
func (rule RecordingRule) String() string
type Rule ¶
type Rule interface { // Name returns the name of the rule. Name() string // String returns a human-readable string representation of the rule. String() string // HTMLSnippet returns a human-readable string representation of the rule, // decorated with HTML elements for use the web frontend. HTMLSnippet(pathPrefix string) html_template.HTML // contains filtered or unexported methods }
A Rule encapsulates a vector expression which is evaluated at a specified interval and acted upon (currently either recorded or used for alerting).
Notes ¶
Bugs ¶
Look at fixing thundering herd.