diff --git a/modules/frontend/metrics_query_range_sharder.go b/modules/frontend/metrics_query_range_sharder.go index 47d3190d640..00cd042078d 100644 --- a/modules/frontend/metrics_query_range_sharder.go +++ b/modules/frontend/metrics_query_range_sharder.go @@ -236,8 +236,6 @@ func (s *queryRangeSharder) buildBackendRequests(ctx context.Context, tenantID s } for startPage := 0; startPage < int(m.TotalRecords); startPage += pages { - subR := parent.HTTPRequest().Clone(ctx) - // Trim and align the request for this block. I.e. if the request is "Last Hour" we don't want to // 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. @@ -266,11 +264,11 @@ func (s *queryRangeSharder) buildBackendRequests(ctx context.Context, tenantID s Exemplars: exemplars, } - return api.BuildQueryRangeRequest(subR, queryRangeReq, dedColsJSON), nil + return api.BuildQueryRangeRequest(r, queryRangeReq, dedColsJSON), nil }) // TODO: Handle sampling rate - key := queryRangeCacheKey(tenantID, queryHash, int64(start), int64(end), m, int(step), int(pages)) + key := queryRangeCacheKey(tenantID, queryHash, int64(start), int64(end), m, int(step), pages) if len(key) > 0 { pipelineR.SetCacheKey(key) } diff --git a/modules/frontend/traceid_sharder.go b/modules/frontend/traceid_sharder.go index 0fa9a839f5d..b2bac662a1a 100644 --- a/modules/frontend/traceid_sharder.go +++ b/modules/frontend/traceid_sharder.go @@ -1,7 +1,6 @@ package frontend import ( - "context" "encoding/hex" "net/http" @@ -44,7 +43,7 @@ func (s asyncTraceSharder) RoundTrip(pipelineRequest pipeline.Request) (pipeline defer span.End() pipelineRequest.WithContext(ctx) - reqs, err := s.buildShardedRequests(ctx, pipelineRequest) + reqs, err := s.buildShardedRequests(pipelineRequest) if err != nil { return nil, err } @@ -71,7 +70,7 @@ func (s asyncTraceSharder) RoundTrip(pipelineRequest pipeline.Request) (pipeline // buildShardedRequests returns a slice of requests sharded on the precalculated // block boundaries -func (s *asyncTraceSharder) buildShardedRequests(ctx context.Context, parent pipeline.Request) ([]pipeline.Request, error) { +func (s *asyncTraceSharder) buildShardedRequests(parent pipeline.Request) ([]pipeline.Request, error) { userID, err := user.ExtractOrgID(parent.Context()) if err != nil { return nil, err diff --git a/modules/frontend/traceid_sharder_test.go b/modules/frontend/traceid_sharder_test.go index 597429b538f..4bc9dbca631 100644 --- a/modules/frontend/traceid_sharder_test.go +++ b/modules/frontend/traceid_sharder_test.go @@ -25,7 +25,7 @@ func TestBuildShardedRequests(t *testing.T) { ctx := user.InjectOrgID(context.Background(), "blerg") req := httptest.NewRequest("GET", "/", nil).WithContext(ctx) - shardedReqs, err := sharder.buildShardedRequests(ctx, pipeline.NewHTTPRequest(req)) + shardedReqs, err := sharder.buildShardedRequests(pipeline.NewHTTPRequest(req)) require.NoError(t, err) require.Len(t, shardedReqs, queryShards)