Skip to content

Commit

Permalink
fix(spans): corrects early-close for a few spans (#12887)
Browse files Browse the repository at this point in the history
  • Loading branch information
owen-d authored May 3, 2024
1 parent 66e235c commit 93aaf29
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
14 changes: 12 additions & 2 deletions pkg/indexgateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ func (g *Gateway) boundedShards(
// sending multiple requests to the entire keyspace).

logger := util_log.WithContext(ctx, g.log)
sp, ctx := opentracing.StartSpanFromContext(ctx, "indexgateway.getShardsWithBlooms")
sp, ctx := opentracing.StartSpanFromContext(ctx, "indexgateway.boundedShards")
defer sp.Finish()

// 1) for all bounds, get chunk refs
Expand All @@ -431,6 +431,11 @@ func (g *Gateway) boundedShards(
for _, g := range grps {
ct += len(g)
}

sp.LogKV(
"stage", "queried local index",
"index_chunks_resolved", ct,
)
// TODO(owen-d): pool
refs := make([]*logproto.ChunkRef, 0, ct)

Expand All @@ -443,11 +448,15 @@ func (g *Gateway) boundedShards(
filtered := refs

// 2) filter via blooms if enabled
if g.bloomQuerier != nil && len(syntax.ExtractLineFilters(p.Plan().AST)) > 0 {
filters := syntax.ExtractLineFilters(p.Plan().AST)
if g.bloomQuerier != nil && len(filters) > 0 {
filtered, err = g.bloomQuerier.FilterChunkRefs(ctx, instanceID, req.From, req.Through, refs, p.Plan())
if err != nil {
return err
}
sp.LogKV(
"stage", "queried bloom gateway",
)
}

g.metrics.preFilterChunks.WithLabelValues(routeShards).Observe(float64(ct))
Expand Down Expand Up @@ -508,6 +517,7 @@ func (g *Gateway) boundedShards(
"through", req.Through.Time().String(),
"length", req.Through.Time().Sub(req.From.Time()).String(),
"end_delta", time.Since(req.Through.Time()).String(),
"filters", len(filters),
)

// 3) build shards
Expand Down
1 change: 0 additions & 1 deletion pkg/querier/queryrange/limits.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ func (q *querySizeLimiter) guessLimitName() string {

func (q *querySizeLimiter) Do(ctx context.Context, r queryrangebase.Request) (queryrangebase.Response, error) {
log := spanlogger.FromContext(ctx)
defer log.Finish()

// Only support TSDB
schemaCfg, err := q.getSchemaCfg(r)
Expand Down
1 change: 0 additions & 1 deletion pkg/querier/queryrange/shard_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ func (r *dynamicShardResolver) ShardingRanges(expr syntax.Expr, targetBytesPerSh
error,
) {
log := spanlogger.FromContext(r.ctx)
defer log.Finish()

adjustedFrom := r.from

Expand Down

0 comments on commit 93aaf29

Please sign in to comment.