From 922f1daf5d1780c3b96b0cb7b150f1fe65379262 Mon Sep 17 00:00:00 2001 From: Cyril Tovena Date: Tue, 4 Jun 2019 08:28:47 -0400 Subject: [PATCH] Remove label __name__ from store querier (#648) --- pkg/querier/store.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/querier/store.go b/pkg/querier/store.go index 3c3edab5b1be7..9a2c90219a9b4 100644 --- a/pkg/querier/store.go +++ b/pkg/querier/store.go @@ -106,7 +106,11 @@ func buildIterators(ctx context.Context, req *logproto.QueryRequest, chks map[mo func buildHeapIterator(ctx context.Context, req *logproto.QueryRequest, chks [][]chunkenc.LazyChunk) (iter.EntryIterator, error) { result := make([]iter.EntryIterator, 0, len(chks)) - + if chks[0][0].Chunk.Metric.Has("__name__") { + labelsBuilder := labels.NewBuilder(chks[0][0].Chunk.Metric) + labelsBuilder.Del("__name__") + chks[0][0].Chunk.Metric = labelsBuilder.Labels() + } labels := chks[0][0].Chunk.Metric.String() for i := range chks { @@ -184,11 +188,6 @@ func partitionBySeriesChunks(chunks [][]chunk.Chunk, fetchers []*chunk.Fetcher) for _, c := range chks { fp := c.Fingerprint chunksByFp[fp] = append(chunksByFp[fp], chunkenc.LazyChunk{Chunk: c, Fetcher: fetchers[i]}) - if c.Metric.Has("__name__") { - labelsBuilder := labels.NewBuilder(c.Metric) - labelsBuilder.Del("__name__") - c.Metric = labelsBuilder.Labels() - } } }