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

Method SearchTagValuesHandler

modules/querier/http.go:250–287  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

248}
249
250func (q *Querier) SearchTagValuesHandler(w http.ResponseWriter, r *http.Request) {
251 isSearchBlock := api.IsSearchBlock(r)
252
253 // Enforce the query timeout while querying backends
254 ctx, cancel := context.WithDeadline(r.Context(), time.Now().Add(q.cfg.Search.QueryTimeout))
255 defer cancel()
256
257 ctx, span := tracer.Start(ctx, "Querier.SearchTagValuesHandler")
258 defer span.End()
259
260 var resp *tempopb.SearchTagValuesResponse
261 if !isSearchBlock {
262 req, err := api.ParseSearchTagValuesRequest(r)
263 if err != nil {
264 http.Error(w, err.Error(), http.StatusBadRequest)
265 return
266 }
267
268 resp, err = q.SearchTagValues(ctx, req)
269 if err != nil {
270 handleError(w, err)
271 return
272 }
273 } else {
274 req, err := api.ParseSearchTagValuesBlockRequest(r)
275 if err != nil {
276 http.Error(w, err.Error(), http.StatusBadRequest)
277 return
278 }
279 resp, err = q.SearchTagValuesBlocks(ctx, req)
280 if err != nil {
281 handleError(w, err)
282 return
283 }
284 }
285
286 writeFormattedContentForRequest(w, r, resp, span)
287}
288
289func (q *Querier) SearchTagValuesV2Handler(w http.ResponseWriter, r *http.Request) {
290 isSearchBlock := api.IsSearchBlock(r)

Callers

nothing calls this directly

Calls 12

SearchTagValuesMethod · 0.95
SearchTagValuesBlocksMethod · 0.95
IsSearchBlockFunction · 0.92
handleErrorFunction · 0.85
ContextMethod · 0.65
AddMethod · 0.65
NowMethod · 0.65
StartMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected