(w http.ResponseWriter, r *http.Request)
| 125 | } |
| 126 | |
| 127 | func (q *Querier) SearchHandler(w http.ResponseWriter, r *http.Request) { |
| 128 | isSearchBlock := api.IsSearchBlock(r) |
| 129 | |
| 130 | // Enforce the query timeout while querying backends |
| 131 | ctx, cancel := context.WithDeadline(r.Context(), time.Now().Add(q.cfg.Search.QueryTimeout)) |
| 132 | defer cancel() |
| 133 | |
| 134 | ctx, span := tracer.Start(ctx, "Querier.SearchHandler") |
| 135 | defer span.End() |
| 136 | |
| 137 | span.SetAttributes(attribute.String("requestURI", r.RequestURI)) |
| 138 | span.SetAttributes(attribute.Bool("isSearchBlock", isSearchBlock)) |
| 139 | |
| 140 | var resp *tempopb.SearchResponse |
| 141 | if !isSearchBlock { |
| 142 | req, err := api.ParseSearchRequest(r) |
| 143 | if err != nil { |
| 144 | http.Error(w, err.Error(), http.StatusBadRequest) |
| 145 | return |
| 146 | } |
| 147 | |
| 148 | span.SetAttributes(attribute.String("SearchRequest", req.String())) |
| 149 | |
| 150 | resp, err = q.SearchRecent(ctx, req) |
| 151 | if err != nil { |
| 152 | handleError(w, err) |
| 153 | return |
| 154 | } |
| 155 | } else { |
| 156 | req, err := api.ParseSearchBlockRequest(r) |
| 157 | if err != nil { |
| 158 | http.Error(w, err.Error(), http.StatusBadRequest) |
| 159 | return |
| 160 | } |
| 161 | |
| 162 | span.SetAttributes(attribute.String("SearchRequestBlock", req.String())) |
| 163 | |
| 164 | resp, err = q.SearchBlock(ctx, req) |
| 165 | if err != nil { |
| 166 | handleError(w, err) |
| 167 | return |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | writeFormattedContentForRequest(w, r, resp, span) |
| 172 | } |
| 173 | |
| 174 | func (q *Querier) SearchTagsHandler(w http.ResponseWriter, r *http.Request) { |
| 175 | isSearchBlock := api.IsSearchBlock(r) |
nothing calls this directly
no test coverage detected