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

Function handleError

modules/querier/http.go:384–403  ·  view source on GitHub ↗
(w http.ResponseWriter, err error)

Source from the content-addressed store, hash-verified

382}
383
384func handleError(w http.ResponseWriter, err error) {
385 if err == nil {
386 return
387 }
388
389 if errors.Is(err, context.Canceled) {
390 // todo: context is also canceled when we hit the query timeout. research what the behavior is
391 // ignore this error. we regularly cancel context once queries are complete
392 return
393 }
394
395 // TODO: better understand all errors returned from queriers and categorize more as 4XX
396 // NOTE: we receive a GRPC error from the ingesters, and so we need to check the string content of error as well.
397 if errors.Is(err, trace.ErrTraceTooLarge) || strings.Contains(err.Error(), trace.ErrTraceTooLarge.Error()) {
398 http.Error(w, err.Error(), http.StatusUnprocessableEntity)
399 return
400 }
401
402 http.Error(w, err.Error(), http.StatusInternalServerError)
403}
404
405func writeFormattedContentForRequest(w http.ResponseWriter, req *http.Request, m proto.Message, span oteltrace.Span) {
406 // Check for both explicit nil and typed nil pointers (e.g., (*tempopb.SearchResponse)(nil))

Callers 8

TraceByIDHandlerMethod · 0.85
TraceByIDHandlerV2Method · 0.85
SearchHandlerMethod · 0.85
SearchTagsHandlerMethod · 0.85
SearchTagsV2HandlerMethod · 0.85
QueryRangeHandlerMethod · 0.85

Calls 1

ErrorMethod · 0.65

Tested by

no test coverage detected