Skip to content

Commit

Permalink
TraceQL Metrics: skip blocks with no overlap (#3886)
Browse files Browse the repository at this point in the history
* skip blocks with no overlap

Signed-off-by: Joe Elliott <[email protected]>

* add msg

Signed-off-by: Joe Elliott <[email protected]>

---------

Signed-off-by: Joe Elliott <[email protected]>
  • Loading branch information
joe-elliott authored Jul 19, 2024
1 parent 8a5cf47 commit 09e765b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/frontend/metrics_query_range_sharder.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"time"

"github.com/go-kit/log" //nolint:all deprecated
"github.com/go-kit/log/level"
"github.com/gogo/protobuf/jsonpb"
"github.com/grafana/dskit/user"
"github.com/opentracing/opentracing-go"
Expand Down Expand Up @@ -376,6 +377,10 @@ func (s *queryRangeSharder) buildBackendRequests(ctx context.Context, tenantID s
// cache the response for that, we want only the few minutes time range for this block. This has
// size savings but the main thing is that the response is reuseable for any overlapping query.
start, end, step := traceql.TrimToOverlap(searchReq.Start, searchReq.End, searchReq.Step, uint64(m.StartTime.UnixNano()), uint64(m.EndTime.UnixNano()))
if start == end || step == 0 {
level.Warn(s.logger).Log("msg", "invalid start/step end. skipping", "start", start, "end", end, "step", step, "blockStart", m.StartTime.UnixNano(), "blockEnd", m.EndTime.UnixNano())
continue
}

queryRangeReq := &tempopb.QueryRangeRequest{
Query: searchReq.Query,
Expand Down

0 comments on commit 09e765b

Please sign in to comment.