mirror of
https://github.com/prometheus/prometheus.git
synced 2025-12-05 09:31:06 +01:00
[PERF] PromQL: only reset labels builder when needed
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
This commit is contained in:
parent
f5d1cb48ca
commit
85150f9dec
@ -2951,7 +2951,6 @@ func resultMetric(lhs, rhs labels.Labels, op parser.ItemType, matching *parser.V
|
||||
enh.resultMetric = make(map[string]labels.Labels, len(enh.Out))
|
||||
}
|
||||
|
||||
enh.resetBuilder(lhs)
|
||||
buf := bytes.NewBuffer(enh.lblResultBuf[:0])
|
||||
enh.lblBuf = lhs.Bytes(enh.lblBuf)
|
||||
buf.Write(enh.lblBuf)
|
||||
@ -2964,6 +2963,7 @@ func resultMetric(lhs, rhs labels.Labels, op parser.ItemType, matching *parser.V
|
||||
}
|
||||
str := string(enh.lblResultBuf)
|
||||
|
||||
enh.resetBuilder(lhs)
|
||||
if changesMetricSchema(op) {
|
||||
// Setting empty Metadata causes the deletion of those if they exists.
|
||||
schema.Metadata{}.SetToLabels(enh.lb)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user