app/vmselect/promql: reduce memory allocations at getCommonLabelFilters() function

Intern tag keys and values there
This commit is contained in:
Aliaksandr Valialkin 2023-01-12 01:26:19 -08:00
parent a819e30ddf
commit d33a65e401
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1

View file

@ -525,7 +525,9 @@ func getCommonLabelFilters(tss []*timeseries) []metricsql.LabelFilter {
m := make(map[string][]string)
for _, ts := range tss {
for _, tag := range ts.MetricName.Tags {
m[string(tag.Key)] = append(m[string(tag.Key)], string(tag.Value))
k := bytesutil.InternBytes(tag.Key)
v := bytesutil.InternBytes(tag.Value)
m[k] = append(m[k], v)
}
}
lfs := make([]metricsql.LabelFilter, 0, len(m))