(w http.ResponseWriter, r *http.Request)
| 82 | } |
| 83 | |
| 84 | func (q *Querier) TraceByIDHandlerV2(w http.ResponseWriter, r *http.Request) { |
| 85 | // Enforce the query timeout while querying backends |
| 86 | ctx, cancel := context.WithDeadline(r.Context(), time.Now().Add(q.cfg.TraceByID.QueryTimeout)) |
| 87 | defer cancel() |
| 88 | |
| 89 | ctx, span := tracer.Start(ctx, "Querier.TraceByIDHandlerV2") |
| 90 | defer span.End() |
| 91 | |
| 92 | byteID, err := api.ParseTraceID(r) |
| 93 | if err != nil { |
| 94 | http.Error(w, err.Error(), http.StatusBadRequest) |
| 95 | return |
| 96 | } |
| 97 | |
| 98 | // validate request |
| 99 | blockStart, blockEnd, queryMode, timeStart, timeEnd, err := api.ValidateAndSanitizeRequest(r) |
| 100 | if err != nil { |
| 101 | http.Error(w, err.Error(), http.StatusBadRequest) |
| 102 | return |
| 103 | } |
| 104 | span.AddEvent("validated request", oteltrace.WithAttributes( |
| 105 | attribute.String("blockStart", blockStart), |
| 106 | attribute.String("blockEnd", blockEnd), |
| 107 | attribute.String("queryMode", queryMode), |
| 108 | attribute.String("timeStart", fmt.Sprint(timeStart)), |
| 109 | attribute.String("timeEnd", fmt.Sprint(timeEnd)), |
| 110 | attribute.String("apiVersion", "v2"), |
| 111 | )) |
| 112 | |
| 113 | resp, err := q.FindTraceByID(ctx, &tempopb.TraceByIDRequest{ |
| 114 | TraceID: byteID, |
| 115 | BlockStart: blockStart, |
| 116 | BlockEnd: blockEnd, |
| 117 | QueryMode: queryMode, |
| 118 | AllowPartialTrace: true, |
| 119 | }, timeStart, timeEnd) |
| 120 | if err != nil { |
| 121 | handleError(w, err) |
| 122 | return |
| 123 | } |
| 124 | writeFormattedContentForRequest(w, r, resp, span) |
| 125 | } |
| 126 | |
| 127 | func (q *Querier) SearchHandler(w http.ResponseWriter, r *http.Request) { |
| 128 | isSearchBlock := api.IsSearchBlock(r) |
nothing calls this directly
no test coverage detected