Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Elliott <[email protected]>
  • Loading branch information
joe-elliott committed Oct 28, 2024
1 parent 6d4c914 commit b1be18b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
6 changes: 2 additions & 4 deletions modules/frontend/metrics_query_range_sharder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
}
Expand Down
5 changes: 2 additions & 3 deletions modules/frontend/traceid_sharder.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package frontend

import (
"context"
"encoding/hex"
"net/http"

Expand Down Expand Up @@ -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
}
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion modules/frontend/traceid_sharder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit b1be18b

Please sign in to comment.