Skip to content

Commit

Permalink
fix context propagation for child spans in shard resolver (#6853)
Browse files Browse the repository at this point in the history
Signed-off-by: Owen Diehl <ow.diehl@gmail.com>
  • Loading branch information
owen-d authored Aug 9, 2022
1 parent 57cec8e commit 001a627
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/querier/queryrange/shard_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ type dynamicShardResolver struct {
}

func (r *dynamicShardResolver) Shards(e syntax.Expr) (int, error) {
sp, _ := spanlogger.NewWithLogger(r.ctx, r.logger, "dynamicShardResolver.Shards")
sp, ctx := spanlogger.NewWithLogger(r.ctx, r.logger, "dynamicShardResolver.Shards")
defer sp.Finish()
// We try to shard subtrees in the AST independently if possible, although
// nested binary expressions can make this difficult. In this case,
Expand All @@ -74,7 +74,7 @@ func (r *dynamicShardResolver) Shards(e syntax.Expr) (int, error) {
results := make([]*stats.Stats, 0, len(grps))

start := time.Now()
if err := concurrency.ForEachJob(r.ctx, len(grps), r.maxParallelism, func(ctx context.Context, i int) error {
if err := concurrency.ForEachJob(ctx, len(grps), r.maxParallelism, func(ctx context.Context, i int) error {
matchers := syntax.MatchersString(grps[i].Matchers)
diff := grps[i].Interval + grps[i].Offset
adjustedFrom := r.from.Add(-diff)
Expand Down

0 comments on commit 001a627

Please sign in to comment.