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

Function cloneRequestforQueriers

modules/frontend/frontend.go:317–333  ·  view source on GitHub ↗

cloneRequestforQueriers returns a cloned pipeline.Request from the passed pipeline.Request ready for queriers. The caller is given an opportunity to modify the internal http.Request before it is returned using the modHTTP param. If modHTTP is nil, the internal http.Request is returned.

(parent pipeline.Request, tenant string, modHTTP func(*http.Request) (*http.Request, error))

Source from the content-addressed store, hash-verified

315// cloneRequestforQueriers returns a cloned pipeline.Request from the passed pipeline.Request ready for queriers. The caller is given an opportunity
316// to modify the internal http.Request before it is returned using the modHTTP param. If modHTTP is nil, the internal http.Request is returned.
317func cloneRequestforQueriers(parent pipeline.Request, tenant string, modHTTP func(*http.Request) (*http.Request, error)) (pipeline.Request, error) {
318 req := parent.HTTPRequest()
319 clonedHTTPReq := req.Clone(req.Context())
320
321 // give the caller a chance to modify the internal http request
322 if modHTTP != nil {
323 var err error
324 clonedHTTPReq, err = modHTTP(clonedHTTPReq)
325 if err != nil {
326 return nil, err
327 }
328 }
329
330 prepareRequestForQueriers(clonedHTTPReq, tenant)
331
332 return parent.CloneFromHTTPRequest(clonedHTTPReq), nil
333}
334
335// prepareRequestForQueriers modifies the request so they will be farmed correctly to the queriers
336// - adds the tenant header

Callers 7

buildBackendRequestsMethod · 0.85
buildIngesterRequestMethod · 0.85
buildBackendRequestsMethod · 0.85
generatorRequestMethod · 0.85
buildBackendRequestsFunction · 0.85
buildIngesterRequestFunction · 0.85
buildShardedRequestsMethod · 0.85

Calls 5

CloneMethod · 0.80
HTTPRequestMethod · 0.65
ContextMethod · 0.65
CloneFromHTTPRequestMethod · 0.65

Tested by

no test coverage detected