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

Function BuildQueryRequest

pkg/api/http.go:490–505  ·  view source on GitHub ↗

Generic helper to append query parameters to an http request with less allocations

(req *http.Request, queryParams map[string]string)

Source from the content-addressed store, hash-verified

488
489// Generic helper to append query parameters to an http request with less allocations
490func BuildQueryRequest(req *http.Request, queryParams map[string]string) *http.Request {
491 if req == nil {
492 req = &http.Request{
493 URL: &url.URL{},
494 }
495 }
496 qb := newQueryBuilder(req.URL.RawQuery)
497 for k, v := range queryParams {
498 if v == "" {
499 continue
500 }
501 qb.addParam(k, v)
502 }
503 req.URL.RawQuery = qb.query()
504 return req
505}
506
507func bounds(vals url.Values) (time.Time, time.Time, error) {
508 var (

Callers 1

buildShardedRequestsMethod · 0.92

Calls 3

newQueryBuilderFunction · 0.85
addParamMethod · 0.80
queryMethod · 0.80

Tested by

no test coverage detected