Documentation
¶
Overview ¶
Building promethues / cortex alerting rules
Index ¶
- Constants
- Variables
- func MergeLabels(ms ...map[string]string) map[string]string
- type AlertRuleBuilder
- type AlertingRule
- func (a *AlertingRule) And(other *AlertingRule) AlertRuleBuilder
- func (a *AlertingRule) AsRuleFmt() *rulefmt.Rule
- func (a *AlertingRule) Build(id string) (*rulefmt.Rule, error)
- func (a *AlertingRule) IfForSecondsThen(other *AlertingRule, seconds time.Duration) AlertRuleBuilder
- func (a *AlertingRule) IfNotForSecondsThen(other *AlertingRule, seconds time.Duration) AlertRuleBuilder
- func (a *AlertingRule) Or(other *AlertingRule) AlertRuleBuilder
- func (a *AlertingRule) Validate() error
Constants ¶
View Source
const KubeMetricsIsDefinedMetricName = "kube_namespace_created"
View Source
const KubeObjMetricNameMatcher = "kube_.*_status_phase"
KubeObjMetricNameMatcher
PromQl Matcher for kube state metrics
View Source
const KubePodStatusMetricName = "kube_pod_status_phase"
Variables ¶
View Source
var KubeObjMetricCreator = template.Must(template.New("KubeObject").Parse("kube_{{.ObjType}}_status_phase"))
View Source
var KubeObjTypeExtractor = regexp.MustCompile("kube_(.*)_status_phase")
KubeObjTypeExtractor
Group 1 extracts the object type
View Source
var KubeStateAlertIdLabels = []string{}
View Source
var KubeStateAnnotations = map[string]string{}
View Source
var KubeStates = []string{"Pending", "Running", "Succeeded", "Failed", "Unknown"}
Functions ¶
Types ¶
type AlertRuleBuilder ¶
type AlertRuleBuilder interface { And(rule *AlertingRule) AlertRuleBuilder Or(rule *AlertingRule) AlertRuleBuilder IfForSecondsThen(*AlertingRule, time.Duration) AlertRuleBuilder IfNotForSecondsThen(*AlertingRule, time.Duration) AlertRuleBuilder Build(id string) (*rulefmt.Rule, error) }
type AlertingRule ¶
type AlertingRule struct { Alert string Expr string For model.Duration Labels map[string]string Annotations map[string]string }
AlertingRule
Wrapper around rulefmt.Rule that implements the AlertingRuleBuilder interface.
func NewKubeStateRule ¶
func (*AlertingRule) And ¶
func (a *AlertingRule) And(other *AlertingRule) AlertRuleBuilder
func (*AlertingRule) AsRuleFmt ¶
func (a *AlertingRule) AsRuleFmt() *rulefmt.Rule
func (*AlertingRule) IfForSecondsThen ¶
func (a *AlertingRule) IfForSecondsThen(other *AlertingRule, seconds time.Duration) AlertRuleBuilder
func (*AlertingRule) IfNotForSecondsThen ¶
func (a *AlertingRule) IfNotForSecondsThen(other *AlertingRule, seconds time.Duration) AlertRuleBuilder
func (*AlertingRule) Or ¶
func (a *AlertingRule) Or(other *AlertingRule) AlertRuleBuilder
func (*AlertingRule) Validate ¶
func (a *AlertingRule) Validate() error
Click to show internal directories.
Click to hide internal directories.