lib/promscrape: zero out labels after duplicate removal inside mergeLabels()

This commit is contained in:
Aliaksandr Valialkin 2022-04-20 18:35:10 +03:00
parent e9f08b1e6a
commit 1ae16bf671
No known key found for this signature in database
GPG Key ID: A72BEC6CD3D0DED1

View File

@ -1054,7 +1054,7 @@ func getLabelsContext() *labelsContext {
}
func putLabelsContext(lctx *labelsContext) {
labels := lctx.labels[:cap(lctx.labels)]
labels := lctx.labels
for i := range labels {
labels[i].Name = ""
labels[i].Value = ""
@ -1317,6 +1317,12 @@ func mergeLabels(dst []prompbmarshal.Label, swc *scrapeWorkConfig, target string
prevName = label.Name
}
}
tail := dst[len(tmp):]
for i := range tail {
label := &tail[i]
label.Name = ""
label.Value = ""
}
return tmp
}