mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
Avoid copy during remote write if external labels is empty
Signed-off-by: Xiaochao Dong (@damnever) <the.xcdong@gmail.com>
This commit is contained in:
parent
49f775d8a0
commit
2d61d012ff
|
@ -847,6 +847,10 @@ func (t *QueueManager) releaseLabels(ls labels.Labels) {
|
||||||
// processExternalLabels merges externalLabels into ls. If ls contains
|
// processExternalLabels merges externalLabels into ls. If ls contains
|
||||||
// a label in externalLabels, the value in ls wins.
|
// a label in externalLabels, the value in ls wins.
|
||||||
func processExternalLabels(ls labels.Labels, externalLabels []labels.Label) labels.Labels {
|
func processExternalLabels(ls labels.Labels, externalLabels []labels.Label) labels.Labels {
|
||||||
|
if len(externalLabels) == 0 {
|
||||||
|
return ls
|
||||||
|
}
|
||||||
|
|
||||||
b := labels.NewScratchBuilder(ls.Len() + len(externalLabels))
|
b := labels.NewScratchBuilder(ls.Len() + len(externalLabels))
|
||||||
j := 0
|
j := 0
|
||||||
ls.Range(func(l labels.Label) {
|
ls.Range(func(l labels.Label) {
|
||||||
|
|
Loading…
Reference in a new issue