Skip to content

Commit 20775d7

Browse files
Update workflows to use the latest image with go 1.24.0 (#6637)
* bump go mod version to 1.24 Signed-off-by: dankrzeminski32 <[email protected]> * resolve non-constant format string in ErrorF calls Signed-off-by: dankrzeminski32 <[email protected]> * update build with go 1.24 dependancies Signed-off-by: dankrzeminski32 <[email protected]> --------- Signed-off-by: dankrzeminski32 <[email protected]>
1 parent 281284a commit 20775d7

20 files changed

+49
-49
lines changed

.github/workflows/test-build-deploy.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
lint:
1818
runs-on: ubuntu-24.04
1919
container:
20-
image: quay.io/cortexproject/build-image:master-03a8f8c98
20+
image: quay.io/cortexproject/build-image:master-281284ac1
2121
steps:
2222
- name: Checkout Repo
2323
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -46,7 +46,7 @@ jobs:
4646
test:
4747
runs-on: ubuntu-24.04
4848
container:
49-
image: quay.io/cortexproject/build-image:master-03a8f8c98
49+
image: quay.io/cortexproject/build-image:master-281284ac1
5050
steps:
5151
- name: Checkout Repo
5252
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -64,7 +64,7 @@ jobs:
6464
test-no-race:
6565
runs-on: ubuntu-24.04
6666
container:
67-
image: quay.io/cortexproject/build-image:master-03a8f8c98
67+
image: quay.io/cortexproject/build-image:master-281284ac1
6868
steps:
6969
- name: Checkout Repo
7070
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -107,7 +107,7 @@ jobs:
107107
build:
108108
runs-on: ubuntu-24.04
109109
container:
110-
image: quay.io/cortexproject/build-image:master-03a8f8c98
110+
image: quay.io/cortexproject/build-image:master-281284ac1
111111
steps:
112112
- name: Checkout Repo
113113
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -247,14 +247,14 @@ jobs:
247247
run: |
248248
touch build-image/.uptodate
249249
MIGRATIONS_DIR=$(pwd)/cmd/cortex/migrations
250-
make BUILD_IMAGE=quay.io/cortexproject/build-image:master-03a8f8c98 TTY='' configs-integration-test
250+
make BUILD_IMAGE=quay.io/cortexproject/build-image:master-281284ac1 TTY='' configs-integration-test
251251
252252
deploy_website:
253253
needs: [build, test]
254254
if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.repository == 'cortexproject/cortex'
255255
runs-on: ubuntu-24.04
256256
container:
257-
image: quay.io/cortexproject/build-image:master-03a8f8c98
257+
image: quay.io/cortexproject/build-image:master-281284ac1
258258
steps:
259259
- name: Checkout Repo
260260
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -296,7 +296,7 @@ jobs:
296296
if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.repository == 'cortexproject/cortex'
297297
runs-on: ubuntu-24.04
298298
container:
299-
image: quay.io/cortexproject/build-image:master-03a8f8c98
299+
image: quay.io/cortexproject/build-image:master-281284ac1
300300
steps:
301301
- name: Checkout Repo
302302
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ build-image/$(UPTODATE): build-image/*
115115
SUDO := $(shell docker info >/dev/null 2>&1 || echo "sudo -E")
116116
BUILD_IN_CONTAINER := true
117117
BUILD_IMAGE ?= $(IMAGE_PREFIX)build-image
118-
LATEST_BUILD_IMAGE_TAG ?= master-03a8f8c98
118+
LATEST_BUILD_IMAGE_TAG ?= master-281284ac1
119119

120120
# TTY is parameterized to allow Google Cloud Builder to run builds,
121121
# as it currently disallows TTY devices. This value needs to be overridden

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/cortexproject/cortex
22

3-
go 1.23.0
3+
go 1.24.0
44

55
require (
66
github.com/Masterminds/squirrel v1.5.4

pkg/distributor/distributor.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -730,12 +730,12 @@ func (d *Distributor) Push(ctx context.Context, req *cortexpb.WriteRequest) (*co
730730
if errors.Is(err, ha.ReplicasNotMatchError{}) {
731731
// These samples have been deduped.
732732
d.dedupedSamples.WithLabelValues(userID, cluster).Add(float64(numFloatSamples + numHistogramSamples))
733-
return nil, httpgrpc.Errorf(http.StatusAccepted, err.Error())
733+
return nil, httpgrpc.Errorf(http.StatusAccepted, "%s", err.Error())
734734
}
735735

736736
if errors.Is(err, ha.TooManyReplicaGroupsError{}) {
737737
d.validateMetrics.DiscardedSamples.WithLabelValues(validation.TooManyHAClusters, userID).Add(float64(numFloatSamples + numHistogramSamples))
738-
return nil, httpgrpc.Errorf(http.StatusBadRequest, err.Error())
738+
return nil, httpgrpc.Errorf(http.StatusBadRequest, "%s", err.Error())
739739
}
740740

741741
return nil, err
@@ -1053,7 +1053,7 @@ func (d *Distributor) prepareSeriesKeys(ctx context.Context, req *cortexpb.Write
10531053
if validationErr != nil && firstPartialErr == nil {
10541054
// The series labels may be retained by validationErr but that's not a problem for this
10551055
// use case because we format it calling Error() and then we discard it.
1056-
firstPartialErr = httpgrpc.Errorf(http.StatusBadRequest, validationErr.Error())
1056+
firstPartialErr = httpgrpc.Errorf(http.StatusBadRequest, "%s", validationErr.Error())
10571057
}
10581058

10591059
// validateSeries would have returned an emptyPreallocSeries if there were no valid samples.

pkg/frontend/transport/handler.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ const (
3939
)
4040

4141
var (
42-
errCanceled = httpgrpc.Errorf(StatusClientClosedRequest, context.Canceled.Error())
43-
errDeadlineExceeded = httpgrpc.Errorf(http.StatusGatewayTimeout, context.DeadlineExceeded.Error())
44-
errRequestEntityTooLarge = httpgrpc.Errorf(http.StatusRequestEntityTooLarge, "http: request body too large")
42+
errCanceled = httpgrpc.Errorf(StatusClientClosedRequest, "%s", context.Canceled.Error())
43+
errDeadlineExceeded = httpgrpc.Errorf(http.StatusGatewayTimeout, "%s", context.DeadlineExceeded.Error())
44+
errRequestEntityTooLarge = httpgrpc.Errorf(http.StatusRequestEntityTooLarge, "%s", "http: request body too large")
4545
)
4646

4747
const (
@@ -279,7 +279,7 @@ func (f *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
279279
if resp.StatusCode/100 != 2 {
280280
body, err2 := tripperware.BodyBuffer(resp, f.log)
281281
if err2 == nil {
282-
err = httpgrpc.Errorf(resp.StatusCode, string(body))
282+
err = httpgrpc.Errorf(resp.StatusCode, "%s", string(body))
283283
}
284284
}
285285
}

pkg/ingester/ingester.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,7 @@ func (i *Ingester) Push(ctx context.Context, req *cortexpb.WriteRequest) (*corte
11681168
i.stoppedMtx.RUnlock()
11691169

11701170
if err := db.acquireAppendLock(); err != nil {
1171-
return &cortexpb.WriteResponse{}, httpgrpc.Errorf(http.StatusServiceUnavailable, wrapWithUser(err, userID).Error())
1171+
return &cortexpb.WriteResponse{}, httpgrpc.Errorf(http.StatusServiceUnavailable, "%s", wrapWithUser(err, userID).Error())
11721172
}
11731173
defer db.releaseAppendLock()
11741174

@@ -1506,7 +1506,7 @@ func (i *Ingester) Push(ctx context.Context, req *cortexpb.WriteRequest) (*corte
15061506
code = ve.code
15071507
}
15081508
level.Debug(logutil.WithContext(ctx, i.logger)).Log("msg", "partial failures to push", "totalSamples", succeededSamplesCount+failedSamplesCount, "failedSamples", failedSamplesCount, "totalHistograms", succeededHistogramsCount+failedHistogramsCount, "failedHistograms", failedHistogramsCount, "firstPartialErr", firstPartialErr)
1509-
return &cortexpb.WriteResponse{}, httpgrpc.Errorf(code, wrapWithUser(firstPartialErr, userID).Error())
1509+
return &cortexpb.WriteResponse{}, httpgrpc.Errorf(code, "%s", wrapWithUser(firstPartialErr, userID).Error())
15101510
}
15111511

15121512
return &cortexpb.WriteResponse{}, nil

pkg/ingester/ingester_test.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -1316,7 +1316,7 @@ func TestIngester_Push(t *testing.T) {
13161316
},
13171317
cortexpb.API),
13181318
},
1319-
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, wrapWithUser(wrappedTSDBIngestErr(storage.ErrOutOfOrderSample, model.Time(9), cortexpb.FromLabelsToLabelAdapters(metricLabels)), userID).Error()),
1319+
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, "%s", wrapWithUser(wrappedTSDBIngestErr(storage.ErrOutOfOrderSample, model.Time(9), cortexpb.FromLabelsToLabelAdapters(metricLabels)), userID).Error()),
13201320
expectedIngested: []cortexpb.TimeSeries{
13211321
{Labels: metricLabelAdapters, Samples: []cortexpb.Sample{{Value: 2, TimestampMs: 10}}},
13221322
},
@@ -1384,7 +1384,7 @@ func TestIngester_Push(t *testing.T) {
13841384
},
13851385
cortexpb.API),
13861386
},
1387-
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, wrapWithUser(wrappedTSDBIngestErr(storage.ErrOutOfBounds, model.Time(1575043969-(86400*1000)), cortexpb.FromLabelsToLabelAdapters(metricLabels)), userID).Error()),
1387+
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, "%s", wrapWithUser(wrappedTSDBIngestErr(storage.ErrOutOfBounds, model.Time(1575043969-(86400*1000)), cortexpb.FromLabelsToLabelAdapters(metricLabels)), userID).Error()),
13881388
expectedIngested: []cortexpb.TimeSeries{
13891389
{Labels: metricLabelAdapters, Samples: []cortexpb.Sample{{Value: 2, TimestampMs: 1575043969}}},
13901390
},
@@ -1438,7 +1438,7 @@ func TestIngester_Push(t *testing.T) {
14381438
cortexpb.API),
14391439
},
14401440
oooTimeWindow: 5 * time.Minute,
1441-
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, wrapWithUser(wrappedTSDBIngestErr(storage.ErrTooOldSample, model.Time(1575043969-(600*1000)), cortexpb.FromLabelsToLabelAdapters(metricLabels)), userID).Error()),
1441+
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, "%s", wrapWithUser(wrappedTSDBIngestErr(storage.ErrTooOldSample, model.Time(1575043969-(600*1000)), cortexpb.FromLabelsToLabelAdapters(metricLabels)), userID).Error()),
14421442
expectedIngested: []cortexpb.TimeSeries{
14431443
{Labels: metricLabelAdapters, Samples: []cortexpb.Sample{{Value: 2, TimestampMs: 1575043969}}},
14441444
},
@@ -1534,7 +1534,7 @@ func TestIngester_Push(t *testing.T) {
15341534
},
15351535
oooTimeWindow: 5 * time.Minute,
15361536
enableOOONativeHistograms: false,
1537-
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, wrapWithUser(wrappedTSDBIngestErr(storage.ErrOOONativeHistogramsDisabled, model.Time(1575043969-(10)), cortexpb.FromLabelsToLabelAdapters(metricLabels)), userID).Error()),
1537+
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, "%s", wrapWithUser(wrappedTSDBIngestErr(storage.ErrOOONativeHistogramsDisabled, model.Time(1575043969-(10)), cortexpb.FromLabelsToLabelAdapters(metricLabels)), userID).Error()),
15381538
expectedIngested: []cortexpb.TimeSeries{
15391539
{Labels: metricLabelAdapters, Histograms: []cortexpb.Histogram{cortexpb.HistogramToHistogramProto(1575043969, tsdbutil.GenerateTestHistogram(1))}},
15401540
},
@@ -1593,7 +1593,7 @@ func TestIngester_Push(t *testing.T) {
15931593
},
15941594
oooTimeWindow: 5 * time.Minute,
15951595
enableOOONativeHistograms: true,
1596-
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, wrapWithUser(wrappedTSDBIngestErr(storage.ErrTooOldSample, model.Time(1575043969-(600*1000)), cortexpb.FromLabelsToLabelAdapters(metricLabels)), userID).Error()),
1596+
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, "%s", wrapWithUser(wrappedTSDBIngestErr(storage.ErrTooOldSample, model.Time(1575043969-(600*1000)), cortexpb.FromLabelsToLabelAdapters(metricLabels)), userID).Error()),
15971597
expectedIngested: []cortexpb.TimeSeries{
15981598
{Labels: metricLabelAdapters, Histograms: []cortexpb.Histogram{cortexpb.HistogramToHistogramProto(1575043969, tsdbutil.GenerateTestHistogram(1))}},
15991599
},
@@ -1712,7 +1712,7 @@ func TestIngester_Push(t *testing.T) {
17121712
nil,
17131713
cortexpb.API),
17141714
},
1715-
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, wrapWithUser(wrappedTSDBIngestErr(storage.NewDuplicateFloatErr(1575043969, 2, 1), model.Time(1575043969), cortexpb.FromLabelsToLabelAdapters(metricLabels)), userID).Error()),
1715+
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, "%s", wrapWithUser(wrappedTSDBIngestErr(storage.NewDuplicateFloatErr(1575043969, 2, 1), model.Time(1575043969), cortexpb.FromLabelsToLabelAdapters(metricLabels)), userID).Error()),
17161716
expectedIngested: []cortexpb.TimeSeries{
17171717
{Labels: metricLabelAdapters, Samples: []cortexpb.Sample{{Value: 2, TimestampMs: 1575043969}}},
17181718
},
@@ -1766,7 +1766,7 @@ func TestIngester_Push(t *testing.T) {
17661766
},
17671767
},
17681768
},
1769-
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, wrapWithUser(wrappedTSDBIngestExemplarErr(errExemplarRef, model.Time(1000), cortexpb.FromLabelsToLabelAdapters(metricLabels), []cortexpb.LabelAdapter{{Name: "traceID", Value: "123"}}), userID).Error()),
1769+
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, "%s", wrapWithUser(wrappedTSDBIngestExemplarErr(errExemplarRef, model.Time(1000), cortexpb.FromLabelsToLabelAdapters(metricLabels), []cortexpb.LabelAdapter{{Name: "traceID", Value: "123"}}), userID).Error()),
17701770
expectedIngested: nil,
17711771
expectedMetadataIngested: nil,
17721772
additionalMetrics: []string{
@@ -2260,7 +2260,7 @@ func TestIngester_PushNativeHistogramErrors(t *testing.T) {
22602260
req := cortexpb.ToWriteRequest([]labels.Labels{metricLabels}, nil, nil, tc.histograms, cortexpb.API)
22612261
// Push timeseries
22622262
_, err = i.Push(ctx, req)
2263-
assert.Equal(t, httpgrpc.Errorf(http.StatusBadRequest, wrapWithUser(wrappedTSDBIngestErr(tc.expectedErr, model.Time(10), metricLabelAdapters), userID).Error()), err)
2263+
assert.Equal(t, httpgrpc.Errorf(http.StatusBadRequest, "%s", wrapWithUser(wrappedTSDBIngestErr(tc.expectedErr, model.Time(10), metricLabelAdapters), userID).Error()), err)
22642264

22652265
require.Equal(t, testutil.ToFloat64(i.metrics.ingestedHistogramsFail), float64(1))
22662266
})
@@ -5557,7 +5557,7 @@ func TestIngesterPushErrorDuringForcedCompaction(t *testing.T) {
55575557
req, _ := mockWriteRequest(t, labels.Labels{{Name: labels.MetricName, Value: "test"}}, 0, util.TimeToMillis(time.Now()))
55585558
ctx := user.InjectOrgID(context.Background(), userID)
55595559
_, err = i.Push(ctx, req)
5560-
require.Equal(t, httpgrpc.Errorf(http.StatusServiceUnavailable, wrapWithUser(errors.New("forced compaction in progress"), userID).Error()), err)
5560+
require.Equal(t, httpgrpc.Errorf(http.StatusServiceUnavailable, "%s", wrapWithUser(errors.New("forced compaction in progress"), userID).Error()), err)
55615561

55625562
// Ingestion is successful after a flush.
55635563
require.True(t, db.casState(forceCompacting, active))

pkg/querier/tripperware/instantquery/instant_query.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func (instantQueryCodec) DecodeResponse(ctx context.Context, r *http.Response, _
106106
return nil, err
107107
}
108108
if r.StatusCode/100 != 2 {
109-
return nil, httpgrpc.Errorf(r.StatusCode, string(buf))
109+
return nil, httpgrpc.Errorf(r.StatusCode, "%s", string(buf))
110110
}
111111

112112
var resp tripperware.PrometheusResponse

pkg/querier/tripperware/instantquery/limits.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ func (l limitsMiddleware) Do(ctx context.Context, r tripperware.Request) (trippe
4040

4141
tenantIDs, err := tenant.TenantIDs(ctx)
4242
if err != nil {
43-
return nil, httpgrpc.Errorf(http.StatusBadRequest, err.Error())
43+
return nil, httpgrpc.Errorf(http.StatusBadRequest, "%s", err.Error())
4444
}
4545

4646
// Enforce the max query length.
4747
if maxQueryLength := validation.SmallestPositiveNonZeroDurationPerTenant(tenantIDs, l.MaxQueryLength); maxQueryLength > 0 {
4848
expr, err := parser.ParseExpr(r.GetQuery())
4949
if err != nil {
50-
return nil, httpgrpc.Errorf(http.StatusBadRequest, err.Error())
50+
return nil, httpgrpc.Errorf(http.StatusBadRequest, "%s", err.Error())
5151
}
5252

5353
// Enforce query length across all selectors in the query.

pkg/querier/tripperware/instantquery/limits_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func TestLimitsMiddleware_MaxQueryLength(t *testing.T) {
3737
"even though failed to parse expression, should return no error since request will pass to next middleware": {
3838
query: `up[`,
3939
maxQueryLength: thirtyDays,
40-
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, parserErr.Error()).Error(),
40+
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, "%s", parserErr.Error()).Error(),
4141
},
4242
"should succeed on a query not exceeding time range": {
4343
query: `up`,

pkg/querier/tripperware/query_attribute_matcher.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func rejectQueryOrSetPriority(r *http.Request, now time.Time, lookbackDelta time
2626
query := r.FormValue("query")
2727
expr, err := parser.ParseExpr(query)
2828
if err != nil {
29-
return httpgrpc.Errorf(http.StatusBadRequest, err.Error())
29+
return httpgrpc.Errorf(http.StatusBadRequest, "%s", err.Error())
3030
}
3131
minTime, maxTime := util.FindMinMaxTime(r, expr, lookbackDelta, now)
3232

pkg/querier/tripperware/queryrange/limits.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func (l limitsMiddleware) Do(ctx context.Context, r tripperware.Request) (trippe
4343

4444
tenantIDs, err := tenant.TenantIDs(ctx)
4545
if err != nil {
46-
return nil, httpgrpc.Errorf(http.StatusBadRequest, err.Error())
46+
return nil, httpgrpc.Errorf(http.StatusBadRequest, "%s", err.Error())
4747
}
4848

4949
// Clamp the time range based on the max query lookback.
@@ -84,7 +84,7 @@ func (l limitsMiddleware) Do(ctx context.Context, r tripperware.Request) (trippe
8484

8585
expr, err := parser.ParseExpr(r.GetQuery())
8686
if err != nil {
87-
return nil, httpgrpc.Errorf(http.StatusBadRequest, err.Error())
87+
return nil, httpgrpc.Errorf(http.StatusBadRequest, "%s", err.Error())
8888
}
8989

9090
// Enforce query length across all selectors in the query.

pkg/querier/tripperware/queryrange/limits_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ func TestLimitsMiddleware_MaxQueryLength(t *testing.T) {
138138
reqStartTime: now.Add(-time.Hour),
139139
reqEndTime: now,
140140
maxQueryLength: thirtyDays,
141-
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, parserErr.Error()).Error(),
141+
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, "%s", parserErr.Error()).Error(),
142142
},
143143
"should succeed on a query on short time range, ending now": {
144144
maxQueryLength: thirtyDays,

pkg/querier/tripperware/queryrange/query_range.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ var (
3434
SortMapKeys: true,
3535
ValidateJsonRawMessage: false,
3636
}.Froze()
37-
errEndBeforeStart = httpgrpc.Errorf(http.StatusBadRequest, "end timestamp must not be before start time")
38-
errNegativeStep = httpgrpc.Errorf(http.StatusBadRequest, "zero or negative query resolution step widths are not accepted. Try a positive integer")
39-
errStepTooSmall = httpgrpc.Errorf(http.StatusBadRequest, "exceeded maximum resolution of 11,000 points per timeseries. Try decreasing the query resolution (?step=XX)")
37+
errEndBeforeStart = httpgrpc.Errorf(http.StatusBadRequest, "%s", "end timestamp must not be before start time")
38+
errNegativeStep = httpgrpc.Errorf(http.StatusBadRequest, "%s", "zero or negative query resolution step widths are not accepted. Try a positive integer")
39+
errStepTooSmall = httpgrpc.Errorf(http.StatusBadRequest, "%s", "exceeded maximum resolution of 11,000 points per timeseries. Try decreasing the query resolution (?step=XX)")
4040

4141
// Name of the cache control header.
4242
cacheControlHeader = "Cache-Control"
@@ -204,7 +204,7 @@ func (c prometheusCodec) DecodeResponse(ctx context.Context, r *http.Response, _
204204
return nil, err
205205
}
206206
if r.StatusCode/100 != 2 {
207-
return nil, httpgrpc.Errorf(r.StatusCode, string(buf))
207+
return nil, httpgrpc.Errorf(r.StatusCode, "%s", string(buf))
208208
}
209209
log.LogFields(otlog.Int("bytes", len(buf)))
210210

pkg/querier/tripperware/queryrange/results_cache.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ func (s resultsCache) Do(ctx context.Context, r tripperware.Request) (tripperwar
224224
tenantIDs, err := tenant.TenantIDs(ctx)
225225
respWithStats := r.GetStats() != "" && s.cacheQueryableSamplesStats
226226
if err != nil {
227-
return nil, httpgrpc.Errorf(http.StatusBadRequest, err.Error())
227+
return nil, httpgrpc.Errorf(http.StatusBadRequest, "%s", err.Error())
228228
}
229229

230230
// If cache_queryable_samples_stats is enabled we always need request the status upstream
@@ -241,7 +241,7 @@ func (s resultsCache) Do(ctx context.Context, r tripperware.Request) (tripperwar
241241

242242
key := s.splitter.GenerateCacheKey(ctx, tenant.JoinTenantIDs(tenantIDs), r)
243243
if err != nil {
244-
return nil, httpgrpc.Errorf(http.StatusBadRequest, err.Error())
244+
return nil, httpgrpc.Errorf(http.StatusBadRequest, "%s", err.Error())
245245
}
246246

247247
var (

pkg/querier/tripperware/queryrange/split_by_interval.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ func (s splitByInterval) Do(ctx context.Context, r tripperware.Request) (tripper
5454
// to line up the boundaries with step.
5555
interval, err := s.interval(ctx, r)
5656
if err != nil {
57-
return nil, httpgrpc.Errorf(http.StatusBadRequest, err.Error())
57+
return nil, httpgrpc.Errorf(http.StatusBadRequest, "%s", err.Error())
5858
}
5959
reqs, err := splitQuery(r, interval)
6060
if err != nil {
61-
return nil, httpgrpc.Errorf(http.StatusBadRequest, err.Error())
61+
return nil, httpgrpc.Errorf(http.StatusBadRequest, "%s", err.Error())
6262
}
6363
s.splitByCounter.Add(float64(len(reqs)))
6464

pkg/querier/tripperware/roundtrip.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func NewQueryTripperware(
179179
tenantIDs, err := tenant.TenantIDs(r.Context())
180180
// This should never happen anyways because we have auth middleware before this.
181181
if err != nil {
182-
return nil, httpgrpc.Errorf(http.StatusBadRequest, err.Error())
182+
return nil, httpgrpc.Errorf(http.StatusBadRequest, "%s", err.Error())
183183
}
184184
now := time.Now()
185185
userStr := tenant.JoinTenantIDs(tenantIDs)
@@ -255,7 +255,7 @@ func (q roundTripper) Do(ctx context.Context, r Request) (Response, error) {
255255
}
256256

257257
if err := user.InjectOrgIDIntoHTTPRequest(ctx, request); err != nil {
258-
return nil, httpgrpc.Errorf(http.StatusBadRequest, err.Error())
258+
return nil, httpgrpc.Errorf(http.StatusBadRequest, "%s", err.Error())
259259
}
260260

261261
response, err := q.next.RoundTrip(request)

0 commit comments

Comments
 (0)