From cf2e80a86931667cc4e504505036e99813c2cfa5 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Fri, 1 Mar 2024 21:26:50 +0200 Subject: [PATCH] lib/promrelabel: use clear() function inside CleanLabels() --- lib/promrelabel/relabel.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/promrelabel/relabel.go b/lib/promrelabel/relabel.go index 41995e84e..ba0a896ab 100644 --- a/lib/promrelabel/relabel.go +++ b/lib/promrelabel/relabel.go @@ -589,9 +589,7 @@ func GetLabelByName(labels []prompbmarshal.Label, name string) *prompbmarshal.La // // This should help GC cleaning up label.Name and label.Value strings. func CleanLabels(labels []prompbmarshal.Label) { - for i := range labels { - labels[i] = prompbmarshal.Label{} - } + clear(labels) } // LabelsToString returns Prometheus string representation for the given labels.