mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-03-11 15:34:56 +00:00
lib/promscrape: further reduce memory usage for per-scrape target labels by making a copy of actually used labels
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/825
This commit is contained in:
parent
ef6ab3d2c9
commit
6c24c5caa3
1 changed files with 2 additions and 2 deletions
|
@ -643,10 +643,10 @@ func appendScrapeWork(dst []ScrapeWork, swc *scrapeWorkConfig, target string, ex
|
||||||
promrelabel.SortLabels(originalLabels)
|
promrelabel.SortLabels(originalLabels)
|
||||||
labels = promrelabel.ApplyRelabelConfigs(labels, 0, swc.relabelConfigs, false)
|
labels = promrelabel.ApplyRelabelConfigs(labels, 0, swc.relabelConfigs, false)
|
||||||
labels = promrelabel.RemoveMetaLabels(labels[:0], labels)
|
labels = promrelabel.RemoveMetaLabels(labels[:0], labels)
|
||||||
// Remove references to already deleted labels, so GC could clean strings for label name and label value.
|
// Remove references to already deleted labels, so GC could clean strings for label name and label value past len(labels).
|
||||||
// This should reduce memory usage when relabeling creates big number of temporary labels with long names and/or values.
|
// This should reduce memory usage when relabeling creates big number of temporary labels with long names and/or values.
|
||||||
// See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/825 for details.
|
// See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/825 for details.
|
||||||
promrelabel.CleanLabels(labels[len(labels):cap(labels)])
|
labels = append([]prompbmarshal.Label{}, labels...)
|
||||||
|
|
||||||
if len(labels) == 0 {
|
if len(labels) == 0 {
|
||||||
// Drop target without labels.
|
// Drop target without labels.
|
||||||
|
|
Loading…
Reference in a new issue