@@ -22,7 +22,6 @@ import (
22
22
"github.com/weaveworks/common/httpgrpc/server"
23
23
"google.golang.org/grpc/status"
24
24
25
- "github.com/cortexproject/cortex/pkg/ingester/client"
26
25
querier_stats "github.com/cortexproject/cortex/pkg/querier/stats"
27
26
"github.com/cortexproject/cortex/pkg/querier/tripperware"
28
27
"github.com/cortexproject/cortex/pkg/tenant"
@@ -34,9 +33,6 @@ const (
34
33
// StatusClientClosedRequest is the status code for when a client request cancellation of an http request
35
34
StatusClientClosedRequest = 499
36
35
ServiceTimingHeaderName = "Server-Timing"
37
-
38
- // Queries are a set of matchers with time ranges - should not get into megabytes
39
- maxRemoteReadQuerySize = 1024 * 1024
40
36
)
41
37
42
38
var (
@@ -143,22 +139,15 @@ func (f *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
143
139
r .Body = io .NopCloser (io .TeeReader (r .Body , & buf ))
144
140
// We parse form here so that we can use buf as body, in order to
145
141
// prevent https://github.com/cortexproject/cortex/issues/5201.
146
- if strings .Contains (r .URL .Path , "api/v1/read" ) {
147
- var req client.ReadRequest
148
- if err := util .ParseProtoReader (r .Context (), r .Body , int (r .ContentLength ), maxRemoteReadQuerySize , & req , util .RawSnappy ); err != nil {
149
- level .Error (util_log .WithContext (r .Context (), f .log )).Log ("msg" , "failed to parse proto" , "err" , err .Error ())
150
- http .Error (w , err .Error (), http .StatusBadRequest )
151
- return
152
- }
153
- } else {
142
+ // Exclude remote read here as we don't have to buffer its body.
143
+ if ! strings .Contains (r .URL .Path , "api/v1/read" ) {
154
144
if err := r .ParseForm (); err != nil {
155
145
writeError (w , err )
156
146
return
157
147
}
148
+ r .Body = io .NopCloser (& buf )
158
149
}
159
150
160
- r .Body = io .NopCloser (& buf )
161
-
162
151
startTime := time .Now ()
163
152
resp , err := f .roundTripper .RoundTrip (r )
164
153
queryResponseTime := time .Since (startTime )
0 commit comments