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))
| 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. |
| 317 | func 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 |
no test coverage detected