lib/promrelabel: use clear() function inside CleanLabels()

This commit is contained in:
Aliaksandr Valialkin 2024-03-01 21:26:50 +02:00
parent 8ce65e93d0
commit 7533070a52
No known key found for this signature in database
GPG Key ID: 52C003EE2BCDB9EB

View File

@ -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.