MCPcopy
hub / github.com/grafana/tempo / runRequest

Method runRequest

modules/querier/worker/frontend_processor.go:164–195  ·  view source on GitHub ↗
(ctx context.Context, request *httpgrpc.HTTPRequest)

Source from the content-addressed store, hash-verified

162}
163
164func (fp *frontendProcessor) runRequest(ctx context.Context, request *httpgrpc.HTTPRequest) *httpgrpc.HTTPResponse {
165 carrier := (*httpgrpcutil.HttpgrpcHeadersCarrier)(request)
166 ctx = otel.GetTextMapPropagator().Extract(ctx, carrier)
167 ctx, queueSpan := tracer.Start(ctx, "querier_processor_runRequest")
168 defer queueSpan.End()
169
170 response, err := fp.handler.Handle(ctx, request)
171 if err != nil {
172 var ok bool
173 response, ok = httpgrpc.HTTPResponseFromError(err)
174 if !ok {
175 response = &httpgrpc.HTTPResponse{
176 Code: http.StatusInternalServerError,
177 Body: []byte(err.Error()),
178 }
179 }
180 }
181
182 // Ensure responses that are too big are not retried.
183 if len(response.Body) >= fp.maxMessageSize {
184 errMsg := fmt.Sprintf("response larger than the max (%d vs %d)", len(response.Body), fp.maxMessageSize)
185 response = &httpgrpc.HTTPResponse{
186 Code: http.StatusRequestEntityTooLarge,
187 Body: []byte(errMsg),
188 }
189 level.Error(fp.log).Log("msg", "error processing query", "err", errMsg)
190 }
191
192 fp.metricRequestsTotal.Inc()
193
194 return response
195}
196
197func (fp *frontendProcessor) handleSendError(err error) error {
198 if err == nil {

Callers 2

processMethod · 0.95
runRequestsMethod · 0.95

Calls 5

StartMethod · 0.65
HandleMethod · 0.65
ErrorMethod · 0.65
LogMethod · 0.65
IncMethod · 0.65

Tested by

no test coverage detected