From fac3193b6dce0659a37ea7c99bba0e0cb726bf78 Mon Sep 17 00:00:00 2001 From: Saswata Mukherjee Date: Wed, 30 Aug 2023 11:14:58 +0530 Subject: [PATCH] store: Record stats even on ExpandPostings error (#6679) --- pkg/store/bucket.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/store/bucket.go b/pkg/store/bucket.go index a52efab72a..f800eaf9ff 100644 --- a/pkg/store/bucket.go +++ b/pkg/store/bucket.go @@ -1364,15 +1364,18 @@ func (s *BucketStore) Series(req *storepb.SeriesRequest, seriesSrv storepb.Store "block.resolution": blk.meta.Thanos.Downsample.Resolution, }) - if err := blockClient.ExpandPostings(sortedBlockMatchers, seriesLimiter); err != nil { - span.Finish() - return errors.Wrapf(err, "fetch series for block %s", blk.meta.ULID) - } onClose := func() { mtx.Lock() stats = blockClient.MergeStats(stats) mtx.Unlock() } + + if err := blockClient.ExpandPostings(sortedBlockMatchers, seriesLimiter); err != nil { + onClose() + span.Finish() + return errors.Wrapf(err, "fetch postings for block %s", blk.meta.ULID) + } + part := newLazyRespSet( srv.Context(), span,