mirror of https://github.com/prometheus/prometheus
rules: call NewScratchBuilder
Need to initialize ScratchBuilder with a SymbolTable. Signed-off-by: Bryan Boreham <bjboreham@gmail.com>pull/12304/head
parent
925134e6de
commit
3716326f3f
|
@ -356,6 +356,8 @@ func (r *AlertingRule) Eval(ctx context.Context, ts time.Time, query QueryFunc,
|
||||||
// or update the expression value for existing elements.
|
// or update the expression value for existing elements.
|
||||||
resultFPs := map[uint64]struct{}{}
|
resultFPs := map[uint64]struct{}{}
|
||||||
|
|
||||||
|
lb := labels.NewBuilder(labels.EmptyLabels())
|
||||||
|
sb := labels.NewScratchBuilder(0)
|
||||||
var vec promql.Vector
|
var vec promql.Vector
|
||||||
alerts := make(map[uint64]*Alert, len(res))
|
alerts := make(map[uint64]*Alert, len(res))
|
||||||
for _, smpl := range res {
|
for _, smpl := range res {
|
||||||
|
@ -391,14 +393,14 @@ func (r *AlertingRule) Eval(ctx context.Context, ts time.Time, query QueryFunc,
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
lb := labels.NewBuilder(smpl.Metric).Del(labels.MetricName)
|
lb.Reset(smpl.Metric)
|
||||||
|
lb.Del(labels.MetricName)
|
||||||
r.labels.Range(func(l labels.Label) {
|
r.labels.Range(func(l labels.Label) {
|
||||||
lb.Set(l.Name, expand(l.Value))
|
lb.Set(l.Name, expand(l.Value))
|
||||||
})
|
})
|
||||||
lb.Set(labels.AlertName, r.Name())
|
lb.Set(labels.AlertName, r.Name())
|
||||||
|
|
||||||
sb := labels.ScratchBuilder{}
|
sb.Reset()
|
||||||
r.annotations.Range(func(a labels.Label) {
|
r.annotations.Range(func(a labels.Label) {
|
||||||
sb.Add(a.Name, expand(a.Value))
|
sb.Add(a.Name, expand(a.Value))
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue