Skip to content

Commit

Permalink
querier: Actually use select mint,maxt params during select. (#1675)
Browse files Browse the repository at this point in the history
This will definitely helps with offset queries.

Same was done on cortexproject/cortex#1012

Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
Signed-off-by: Giedrius Statkevičius <giedriuswork@gmail.com>
  • Loading branch information
bwplotka authored and GiedriusS committed Oct 28, 2019
1 parent cf33849 commit 37ae6dd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 3 additions & 2 deletions pkg/query/api/v1.go
Expand Up @@ -503,7 +503,8 @@ func (api *API) series(r *http.Request) (interface{}, []error, *ApiError) {
}

// TODO(bwplotka): Support downsampling?
q, err := api.queryableCreate(enableDedup, replicaLabels, 0, enablePartialResponse).Querier(r.Context(), timestamp.FromTime(start), timestamp.FromTime(end))
q, err := api.queryableCreate(enableDedup, replicaLabels, 0, enablePartialResponse).
Querier(r.Context(), timestamp.FromTime(start), timestamp.FromTime(end))
if err != nil {
return nil, nil, &ApiError{errorExec, err}
}
Expand All @@ -515,7 +516,7 @@ func (api *API) series(r *http.Request) (interface{}, []error, *ApiError) {
sets []storage.SeriesSet
)
for _, mset := range matcherSets {
s, warns, err := q.Select(&storage.SelectParams{}, mset...)
s, warns, err := q.Select(nil, mset...)
if err != nil {
return nil, nil, &ApiError{errorExec, err}
}
Expand Down
10 changes: 8 additions & 2 deletions pkg/query/querier.go
Expand Up @@ -169,12 +169,18 @@ func (q *querier) Select(params *storage.SelectParams, ms ...*labels.Matcher) (s
return nil, nil, errors.Wrap(err, "convert matchers")
}

if params == nil {
params = &storage.SelectParams{
Start: q.mint,
End: q.maxt,
}
}
queryAggrs, resAggr := aggrsFromFunc(params.Func)

resp := &seriesServer{ctx: ctx}
if err := q.proxy.Series(&storepb.SeriesRequest{
MinTime: q.mint,
MaxTime: q.maxt,
MinTime: params.Start,
MaxTime: params.End,
Matchers: sms,
MaxResolutionWindow: q.maxResolutionMillis,
Aggregates: queryAggrs,
Expand Down

0 comments on commit 37ae6dd

Please sign in to comment.