diff --git a/pkg/store/bucket.go b/pkg/store/bucket.go index d880935c9d..5fe03936a0 100644 --- a/pkg/store/bucket.go +++ b/pkg/store/bucket.go @@ -1349,7 +1349,7 @@ func (s *BucketStore) LabelNames(ctx context.Context, req *storepb.LabelNamesReq func (b *bucketBlock) FilterExtLabelsMatchers(matchers []*labels.Matcher) ([]*labels.Matcher, bool) { // we filter external labels from matchers // so it won't try to match series on them. - var result []*labels.Matcher + var result []*labels.Matcher for _, m := range matchers { // get value of external label from block v := b.extLset.Get(m.Name) @@ -1405,7 +1405,7 @@ func (s *BucketStore) LabelValues(ctx context.Context, req *storepb.LabelValuesR if len(reqBlockMatchers) > 0 && !b.matchRelabelLabels(reqBlockMatchers) { continue } - // filter ext labels + // filter ext labels reqSeriesMatchersNoExtLabels, ok := b.FilterExtLabelsMatchers(reqSeriesMatchers) if !ok { continue diff --git a/pkg/store/bucket_test.go b/pkg/store/bucket_test.go index df2c60041d..bff5f090e5 100644 --- a/pkg/store/bucket_test.go +++ b/pkg/store/bucket_test.go @@ -207,31 +207,31 @@ func TestBucketFilterExtLabelsMatchers(t *testing.T) { }, } b, err := newBucketBlock(context.Background(), log.NewNopLogger(), newBucketStoreMetrics(nil), meta, bkt, path.Join(dir, blockID.String()), nil, nil, nil, nil) - ms := []*labels.Matcher { + ms := []*labels.Matcher{ {Type: labels.MatchNotEqual, Name: "a", Value: "b"}, - } + } res, _ := b.FilterExtLabelsMatchers(ms) testutil.Equals(t, len(res), 0) - ms = []*labels.Matcher { + ms = []*labels.Matcher{ {Type: labels.MatchNotEqual, Name: "a", Value: "a"}, - } + } _, ok := b.FilterExtLabelsMatchers(ms) testutil.Equals(t, ok, false) - ms = []*labels.Matcher { + ms = []*labels.Matcher{ {Type: labels.MatchNotEqual, Name: "a", Value: "a"}, - {Type: labels.MatchNotEqual, Name: "c", Value: "d"}, - } + {Type: labels.MatchNotEqual, Name: "c", Value: "d"}, + } res, _ = b.FilterExtLabelsMatchers(ms) testutil.Equals(t, len(res), 0) - ms = []*labels.Matcher { + ms = []*labels.Matcher{ {Type: labels.MatchNotEqual, Name: "a2", Value: "a"}, - } + } res, _ = b.FilterExtLabelsMatchers(ms) testutil.Equals(t, len(res), 1) - testutil.Equals(t, res, ms) + testutil.Equals(t, res, ms) } func TestBucketBlock_matchLabels(t *testing.T) {