From b3ec1f7aa00031a3bf6328271699c6a422471345 Mon Sep 17 00:00:00 2001 From: Ben Donnelly Date: Thu, 5 Oct 2023 16:37:26 +0100 Subject: [PATCH] fix(querier): queries would not select the correct metas --- examples/docker-compose/.gitignore | 1 + modules/frontend/searchsharding.go | 4 +--- pkg/api/http.go | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/examples/docker-compose/.gitignore b/examples/docker-compose/.gitignore index a23d707..83bf743 100644 --- a/examples/docker-compose/.gitignore +++ b/examples/docker-compose/.gitignore @@ -1,2 +1,3 @@ **/deep-data/ **/tempo-data/ +dev* diff --git a/modules/frontend/searchsharding.go b/modules/frontend/searchsharding.go index a889a9b..b9472b2 100644 --- a/modules/frontend/searchsharding.go +++ b/modules/frontend/searchsharding.go @@ -409,9 +409,7 @@ func (s *searchSharder) ingesterRequest(ctx context.Context, tenantID string, pa subR := parent.Clone(ctx) subR.Header.Set(user.OrgIDHeaderName, tenantID) - searchReq.Start = ingesterStart - searchReq.End = ingesterEnd - subR, err := api.BuildSearchRequest(subR, searchReq) + subR, err := api.BuildIngesterSearchRequest(subR, searchReq, ingesterStart, ingesterEnd) if err != nil { return nil, err } diff --git a/pkg/api/http.go b/pkg/api/http.go index 83c09a1..0192afa 100644 --- a/pkg/api/http.go +++ b/pkg/api/http.go @@ -333,6 +333,23 @@ func ParseSearchBlockRequest(r *http.Request) (*deeppb.SearchBlockRequest, error return req, nil } +// BuildIngesterSearchRequest takes a deeppb.SearchRequest and creates a request for searching the ingesters +func BuildIngesterSearchRequest(req *http.Request, searchReq *deeppb.SearchRequest, start, end uint32) (*http.Request, error) { + if searchReq == nil { + return req, nil + } + + request, err := BuildSearchRequest(req, searchReq) + if err != nil { + return nil, err + } + q := request.URL.Query() + q.Set(urlParamStart, strconv.FormatUint(uint64(start), 10)) + q.Set(urlParamEnd, strconv.FormatUint(uint64(end), 10)) + + return request, nil +} + // BuildSearchRequest takes a deeppb.SearchRequest and populates the passed http.Request // with the appropriate params. If no http.Request is provided a new one is created. func BuildSearchRequest(req *http.Request, searchReq *deeppb.SearchRequest) (*http.Request, error) {