From 7a558300cfff47f3affa192c001cea6f5e1b138f Mon Sep 17 00:00:00 2001 From: yeya24 Date: Thu, 31 Jul 2025 23:15:53 -0700 Subject: [PATCH 1/2] set shards count in span before query execution Signed-off-by: yeya24 --- queryable/parquet_queryable.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/queryable/parquet_queryable.go b/queryable/parquet_queryable.go index 82176ef..e5518ea 100644 --- a/queryable/parquet_queryable.go +++ b/queryable/parquet_queryable.go @@ -164,6 +164,9 @@ func (p parquetQuerier) LabelValues(ctx context.Context, name string, hints *pro if err != nil { return nil, nil, err } + span.SetAttributes( + attribute.Int("shards_count", len(shards)), + ) limit := int64(0) @@ -212,6 +215,9 @@ func (p parquetQuerier) LabelNames(ctx context.Context, hints *prom_storage.Labe if err != nil { return nil, nil, err } + span.SetAttributes( + attribute.Int("shards_count", len(shards)), + ) limit := int64(0) @@ -281,6 +287,11 @@ func (p parquetQuerier) Select(ctx context.Context, sorted bool, sp *prom_storag minT, maxT = sp.Start, sp.End } skipChunks := sp != nil && sp.Func == "series" + span.SetAttributes( + attribute.Int("shards_count", len(shards)), + attribute.Bool("skip_chunks", skipChunks), + ) + errGroup, ctx := errgroup.WithContext(ctx) errGroup.SetLimit(p.opts.concurrency) @@ -296,11 +307,6 @@ func (p parquetQuerier) Select(ctx context.Context, sorted bool, sp *prom_storag return prom_storage.ErrSeriesSet(err) } - span.SetAttributes( - attribute.Int("shards_count", len(shards)), - attribute.Bool("skip_chunks", skipChunks), - ) - ss := convert.NewMergeChunkSeriesSet(seriesSet, labels.Compare, prom_storage.NewConcatenatingChunkSeriesMerger()) return convert.NewSeriesSetFromChunkSeriesSet(ss, skipChunks) From b2ce2e3734c39a4170e817cad18980e15af87466 Mon Sep 17 00:00:00 2001 From: yeya24 Date: Thu, 31 Jul 2025 23:20:32 -0700 Subject: [PATCH 2/2] fix lint Signed-off-by: yeya24 --- search/constraint_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/search/constraint_test.go b/search/constraint_test.go index e8b0643..f60fe52 100644 --- a/search/constraint_test.go +++ b/search/constraint_test.go @@ -513,9 +513,9 @@ type mockConstraint struct { pathName string } -func (m *mockConstraint) String() string { return fmt.Sprintf("mock(%s)", m.pathName) } -func (m *mockConstraint) path() string { return m.pathName } -func (m *mockConstraint) init(f *storage.ParquetFile) error { return nil } +func (m *mockConstraint) String() string { return fmt.Sprintf("mock(%s)", m.pathName) } +func (m *mockConstraint) path() string { return m.pathName } +func (m *mockConstraint) init(f storage.ParquetFileView) error { return nil } func (m *mockConstraint) filter(ctx context.Context, rgIdx int, primary bool, rr []RowRange) ([]RowRange, error) { return rr, nil }