mirror of
https://github.com/prometheus/prometheus
synced 2026-04-30 23:11:34 +08:00
[PERF] PromQL: only reset labels builder when needed
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user