From f0a1ebc19df4bb580bb560a191d121cb7bf3ce67 Mon Sep 17 00:00:00 2001 From: Thomas Jackson Date: Tue, 28 Aug 2018 03:23:31 -0700 Subject: [PATCH] Add SelectParams to Select for federation (#4546) When prom2 came out the storage querier interface consolidated to a single Select() method. While doing this it makes it impossible as the implementer of the querier to know if you are being called for metadata or actual data. The workaround has been to check if the SelectParams are nil, which the federation call is always nil. This has 2 negative consequences (1) remote implementations interpret this as a metadata call, which makes the federation endpoint return nothing. (2) this means that the storage implementations don't get the same information passed down to them as far as SelectParams goes. This diff simply adds SelectParams to the Select() call in the federation handler Mitigation for #4057 Signed-off-by: Thomas Jackson --- web/federate.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/federate.go b/web/federate.go index 121e03271..e34136317 100644 --- a/web/federate.go +++ b/web/federate.go @@ -76,9 +76,14 @@ func (h *Handler) federation(w http.ResponseWriter, req *http.Request) { vec := make(promql.Vector, 0, 8000) + params := &storage.SelectParams{ + Start: mint, + End: maxt, + } + var sets []storage.SeriesSet for _, mset := range matcherSets { - s, err := q.Select(nil, mset...) + s, err := q.Select(params, mset...) if err != nil { federationErrors.Inc() http.Error(w, err.Error(), http.StatusInternalServerError)