Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion pkg/querier/parquet_queryable.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/go-kit/log"
"github.com/go-kit/log/level"
lru "github.com/hashicorp/golang-lru/v2"
"github.com/opentracing/opentracing-go"
"github.com/parquet-go/parquet-go"
"github.com/pkg/errors"
"github.com/prometheus-community/parquet-common/schema"
Expand Down Expand Up @@ -146,6 +147,9 @@ func NewParquetQueryable(
shards := make([]*parquet_storage.ParquetShard, len(blocks))
errGroup := &errgroup.Group{}

span, _ := opentracing.StartSpanFromContext(ctx, "parquetQuerierWithFallback.OpenShards")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to pass ctx to parquet_storage.OpenParquetShard?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call.. lemme try wihtouc cancel

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL?

defer span.Finish()

for i, block := range blocks {
errGroup.Go(func() error {
cacheKey := fmt.Sprintf("%v-%v", userID, block.ID)
Expand All @@ -165,7 +169,7 @@ func NewParquetQueryable(
parquet_storage.WithOptimisticReader(true),
)
if err != nil {
return err
return errors.Wrapf(err, "failed to open parquet shard. block: %v", block.ID.String())
}
cache.Set(cacheKey, shard)
}
Expand Down Expand Up @@ -266,6 +270,9 @@ type parquetQuerierWithFallback struct {
}

func (q *parquetQuerierWithFallback) LabelValues(ctx context.Context, name string, hints *storage.LabelHints, matchers ...*labels.Matcher) ([]string, annotations.Annotations, error) {
span, ctx := opentracing.StartSpanFromContext(ctx, "parquetQuerierWithFallback.LabelValues")
defer span.Finish()

remaining, parquet, err := q.getBlocks(ctx, q.minT, q.maxT)
defer q.incrementOpsMetric("LabelValues", remaining, parquet)
if err != nil {
Expand Down Expand Up @@ -312,6 +319,9 @@ func (q *parquetQuerierWithFallback) LabelValues(ctx context.Context, name strin
}

func (q *parquetQuerierWithFallback) LabelNames(ctx context.Context, hints *storage.LabelHints, matchers ...*labels.Matcher) ([]string, annotations.Annotations, error) {
span, ctx := opentracing.StartSpanFromContext(ctx, "parquetQuerierWithFallback.LabelNames")
defer span.Finish()

remaining, parquet, err := q.getBlocks(ctx, q.minT, q.maxT)
defer q.incrementOpsMetric("LabelNames", remaining, parquet)
if err != nil {
Expand Down Expand Up @@ -359,6 +369,9 @@ func (q *parquetQuerierWithFallback) LabelNames(ctx context.Context, hints *stor
}

func (q *parquetQuerierWithFallback) Select(ctx context.Context, sortSeries bool, h *storage.SelectHints, matchers ...*labels.Matcher) storage.SeriesSet {
span, ctx := opentracing.StartSpanFromContext(ctx, "parquetQuerierWithFallback.Select")
defer span.Finish()

userID, err := tenant.TenantID(ctx)
if err != nil {
storage.ErrSeriesSet(err)
Expand Down Expand Up @@ -408,6 +421,8 @@ func (q *parquetQuerierWithFallback) Select(ctx context.Context, sortSeries bool
p := make(chan storage.SeriesSet, 1)
promises = append(promises, p)
go func() {
span, _ := opentracing.StartSpanFromContext(ctx, "parquetQuerier.Select")
defer span.Finish()
p <- q.parquetQuerier.Select(InjectBlocksIntoContext(ctx, parquet...), sortSeries, &hints, matchers...)
}()
}
Expand Down
Loading