Skip to content

Commit

Permalink
Add SelectParams to Select for federation
Browse files Browse the repository at this point in the history
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 prometheus#4057

Signed-off-by: Thomas Jackson <jacksontj.89@gmail.com>
  • Loading branch information
jacksontj committed Aug 27, 2018
1 parent 3e594b7 commit b401182
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion web/federate.go
Expand Up @@ -72,9 +72,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)
Expand Down

0 comments on commit b401182

Please sign in to comment.