Merge pull request #13492 from bboreham/no-labelstrings-intern

labels: make InternStrings a no-op for stringlabels version
This commit is contained in:
Bryan Boreham 2024-02-06 17:15:10 +01:00 committed by GitHub
commit 3ce816fa3b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -450,14 +450,12 @@ func (ls Labels) DropMetricName() Labels {
return ls return ls
} }
// InternStrings calls intern on every string value inside ls, replacing them with what it returns. // InternStrings is a no-op because it would only save when the whole set of labels is identical.
func (ls *Labels) InternStrings(intern func(string) string) { func (ls *Labels) InternStrings(intern func(string) string) {
ls.data = intern(ls.data)
} }
// ReleaseStrings calls release on every string value inside ls. // ReleaseStrings is a no-op for the same reason as InternStrings.
func (ls Labels) ReleaseStrings(release func(string)) { func (ls Labels) ReleaseStrings(release func(string)) {
release(ls.data)
} }
// Labels returns the labels from the builder. // Labels returns the labels from the builder.