diff --git a/pkg/distributor/otel.go b/pkg/distributor/otel.go index 7f8d859f66f..bf101833572 100644 --- a/pkg/distributor/otel.go +++ b/pkg/distributor/otel.go @@ -229,7 +229,7 @@ func otlpHandler( if err := parser(ctx, r, maxRecvMsgSize, rb, &req, logger); err != nil { // Check for httpgrpc error, default to client error if parsing failed if _, ok := httpgrpc.HTTPResponseFromError(err); !ok { - err = httpgrpc.Errorf(http.StatusBadRequest, err.Error()) + err = httpgrpc.Errorf(http.StatusBadRequest, "%s", err.Error()) } rb.CleanUp() diff --git a/pkg/frontend/querymiddleware/shard_active_native_histogram_metrics_test.go b/pkg/frontend/querymiddleware/shard_active_native_histogram_metrics_test.go index a4e37346263..12f6e1ddf97 100644 --- a/pkg/frontend/querymiddleware/shard_active_native_histogram_metrics_test.go +++ b/pkg/frontend/querymiddleware/shard_active_native_histogram_metrics_test.go @@ -721,7 +721,7 @@ func TestShardActiveNativeHistogramMetricsMiddlewareMergeResponseContextCancella }() cancelCause := "request canceled while streaming response" - cancel(fmt.Errorf(cancelCause)) + cancel(fmt.Errorf("%s", cancelCause)) g.Wait() diff --git a/pkg/frontend/querymiddleware/shard_active_series_test.go b/pkg/frontend/querymiddleware/shard_active_series_test.go index f94f6aa813c..cb226e1d2d3 100644 --- a/pkg/frontend/querymiddleware/shard_active_series_test.go +++ b/pkg/frontend/querymiddleware/shard_active_series_test.go @@ -486,7 +486,7 @@ func runTestShardActiveSeriesMiddlewareMergeResponseContextCancellation(t *testi require.NoError(t, err) cancelCause := "request canceled while streaming response" - cancel(fmt.Errorf(cancelCause)) + cancel(fmt.Errorf("%s", cancelCause)) _, err = io.Copy(&buf, resp.Body) require.NoError(t, err) diff --git a/pkg/frontend/transport/handler.go b/pkg/frontend/transport/handler.go index c30efc1fa32..4c86ae32691 100644 --- a/pkg/frontend/transport/handler.go +++ b/pkg/frontend/transport/handler.go @@ -46,8 +46,8 @@ const ( ) var ( - errCanceled = httpgrpc.Errorf(StatusClientClosedRequest, context.Canceled.Error()) - errDeadlineExceeded = httpgrpc.Errorf(http.StatusGatewayTimeout, context.DeadlineExceeded.Error()) + errCanceled = httpgrpc.Errorf(StatusClientClosedRequest, "%s", context.Canceled.Error()) + errDeadlineExceeded = httpgrpc.Errorf(http.StatusGatewayTimeout, "%s", context.DeadlineExceeded.Error()) errRequestEntityTooLarge = httpgrpc.Errorf(http.StatusRequestEntityTooLarge, "http: request body too large") )