mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-24 21:24:05 -08:00
parent
f9533754d1
commit
6fc88d4b4d
|
@ -198,6 +198,7 @@ func (r *AlertingRule) eval(ts model.Time, engine *promql.Engine, externalURLPat
|
|||
return model.LabelValue(result)
|
||||
}
|
||||
|
||||
delete(smpl.Metric, model.MetricNameLabel)
|
||||
labels := make(model.LabelSet, len(smpl.Metric)+len(r.labels)+1)
|
||||
for ln, lv := range smpl.Metric {
|
||||
labels[ln] = lv
|
||||
|
@ -219,8 +220,6 @@ func (r *AlertingRule) eval(ts model.Time, engine *promql.Engine, externalURLPat
|
|||
continue
|
||||
}
|
||||
|
||||
delete(smpl.Metric, model.MetricNameLabel)
|
||||
|
||||
r.active[fp] = &Alert{
|
||||
Labels: labels,
|
||||
Annotations: annotations,
|
||||
|
|
|
@ -136,6 +136,12 @@ func TestAlertingRule(t *testing.T) {
|
|||
t.Errorf("%d. Expected and actual outputs don't match:", i)
|
||||
t.Fatalf("Expected:\n%v\n----\nActual:\n%v", strings.Join(expected, "\n"), strings.Join(actual, "\n"))
|
||||
}
|
||||
|
||||
for _, aa := range rule.ActiveAlerts() {
|
||||
if _, ok := aa.Labels[model.MetricNameLabel]; ok {
|
||||
t.Fatalf("%s label set on active alert: %s", model.MetricNameLabel, aa.Labels)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue