rules: call NewScratchBuilder
Need to initialize ScratchBuilder with a SymbolTable. Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
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.
|
||||
resultFPs := map[uint64]struct{}{}
|
||||
|
||||
lb := labels.NewBuilder(labels.EmptyLabels())
|
||||
sb := labels.NewScratchBuilder(0)
|
||||
var vec promql.Vector
|
||||
alerts := make(map[uint64]*Alert, len(res))
|
||||
for _, smpl := range res {
|
||||
|
@ -391,14 +393,14 @@ func (r *AlertingRule) Eval(ctx context.Context, ts time.Time, query QueryFunc,
|
|||
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) {
|
||||
lb.Set(l.Name, expand(l.Value))
|
||||
})
|
||||
lb.Set(labels.AlertName, r.Name())
|
||||
|
||||
sb := labels.ScratchBuilder{}
|
||||
sb.Reset()
|
||||
r.annotations.Range(func(a labels.Label) {
|
||||
sb.Add(a.Name, expand(a.Value))
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue