one is "alert"
the other is "name"
one is "expr"
the other is "query"
one is "for"
the other is "duration"
alerting rules file like this:
https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/
groups:
- name: example
rules:
- alert: HighRequestLatency
expr: job:request_latency_seconds:mean5m{job="myjob"} > 0.5
for: 10m
labels:
severity: page
annotations:
summary: High request latency
prometheus/prometheus, type Rule is
https://github.com/prometheus/prometheus/blob/671bb0d5b8ae3695fbf74b05329ed23c61650c72/model/rulefmt/rulefmt.go#L126
type Rule struct {
Record string `yaml:"record,omitempty"`
Alert string `yaml:"alert,omitempty"`
Expr string `yaml:"expr"`
For model.Duration `yaml:"for,omitempty"`
Labels map[string]string `yaml:"labels,omitempty"`
Annotations map[string]string `yaml:"annotations,omitempty"`
}
but why prometheus/client_golang, type Rule is
|
type AlertingRule struct { |
type AlertingRule struct {
Name string `json:"name"`
Query string `json:"query"`
Duration float64 `json:"duration"`
Labels model.LabelSet `json:"labels"`
Annotations model.LabelSet `json:"annotations"`
Alerts []*Alert `json:"alerts"`
Health RuleHealth `json:"health"`
LastError string `json:"lastError,omitempty"`
EvaluationTime float64 `json:"evaluationTime"`
LastEvaluation time.Time `json:"lastEvaluation"`
State string `json:"state"`
}
one is "alert"
the other is "name"
one is "expr"
the other is "query"
one is "for"
the other is "duration"
alerting rules file like this:
https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/
prometheus/prometheus, type Rule is
https://github.com/prometheus/prometheus/blob/671bb0d5b8ae3695fbf74b05329ed23c61650c72/model/rulefmt/rulefmt.go#L126
but why prometheus/client_golang, type Rule is
client_golang/api/prometheus/v1/api.go
Line 350 in dc1559e