Documentation
¶
Index ¶
Constants ¶
View Source
const JITTER_FACTOR = 7000
7 seconds jitter factor for evaluation among different rules
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AlertEvaluator ¶
type AlertEvaluator struct { DB *metrics.TimeSeriesDB Rules []Rule // contains filtered or unexported fields }
AlertEvaluator send new or resolved alerts to alertmanager use alertmanager to implement deduplication, notification it connect TSDB, evaluate all rules to with its own interval for each rule, the query result should contains fields that can be compared with threshold, and other fields which are used to generate alert labelSet and description The query and description can use Go templates with the rule data and query results
func NewAlertEvaluator ¶
func NewAlertEvaluator(ctx context.Context, db *metrics.TimeSeriesDB, rules []Rule, alertManagerURL string) *AlertEvaluator
func (*AlertEvaluator) StartEvaluate ¶
func (e *AlertEvaluator) StartEvaluate() error
func (*AlertEvaluator) StopEvaluate ¶
func (e *AlertEvaluator) StopEvaluate() error
func (*AlertEvaluator) UpdateAlertRules ¶
func (e *AlertEvaluator) UpdateAlertRules(rules []Rule) error
type AlertStatus ¶
type GettableAlert ¶
type GettableAlert struct { Alert Annotations LabelSet `json:"annotations"` Receivers []Receiver `json:"receivers"` Fingerprint string `json:"fingerprint"` StartsAt time.Time `json:"startsAt"` UpdatedAt time.Time `json:"updatedAt"` EndsAt time.Time `json:"endsAt"` Status AlertStatus `json:"status"` }
type PostableAlert ¶
type PostableAlert struct { Alert StartsAt time.Time `json:"startsAt,omitempty"` EndsAt time.Time `json:"endsAt,omitempty"` Annotations LabelSet `json:"annotations,omitempty"` }
func CreateAlertData ¶
type Rule ¶
type Rule struct { Name string `yaml:"name"` Query string `yaml:"query"` Threshold float64 `yaml:"threshold"` EvaluationInterval string `yaml:"evaluationInterval"` ConsecutiveCount int `yaml:"consecutiveCount"` Severity string `yaml:"severity"` Summary string `yaml:"summary"` Description string `yaml:"description"` RunBookURL string `yaml:"runbookURL"` AlertTargetInstance string `yaml:"alertTargetInstance"` // contains filtered or unexported fields }
func (*Rule) AddFiringAlertAndCheckResolved ¶
func (r *Rule) AddFiringAlertAndCheckResolved(alertQueryResult map[string]interface{}) (*PostableAlert, bool, string)
func (*Rule) CheckAndRemoveFiringAlerts ¶
func (r *Rule) CheckAndRemoveFiringAlerts(firingAlertSet map[string]struct{}) []PostableAlert
func (*Rule) IsTestMode ¶
Click to show internal directories.
Click to hide internal directories.