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

This commit is contained in:
Aliaksandr Valialkin 2024-03-01 21:26:50 +02:00
parent 69ab55b6f7
commit cf2e80a869
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.