From 14b4fbc2ff5aaad23937ca2a620b7aa8de24bdad Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Mon, 29 Jan 2024 18:54:54 +0000 Subject: [PATCH] labels: make InternStrings a no-op for stringlabels version The current implementation of `InternStrings` will only save memory when the whole set of labels is identical to one already seen, and this cannot happen in the one place it is called from in Prometheus, remote-write, which already detects identical series. Signed-off-by: Bryan Boreham --- model/labels/labels_stringlabels.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/model/labels/labels_stringlabels.go b/model/labels/labels_stringlabels.go index f53c3b2d0..3e0488bd0 100644 --- a/model/labels/labels_stringlabels.go +++ b/model/labels/labels_stringlabels.go @@ -450,14 +450,12 @@ func (ls Labels) DropMetricName() Labels { 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) { - 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)) { - release(ls.data) } // Labels returns the labels from the builder.