-
Couldn't load subscription status.
- Fork 837
querier: Use select params for mint and maxt #1012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
|
I can't see anything wrong with this! Lets get it into dev... |
| func (q *chunkStoreQuerier) Select(_ *storage.SelectParams, matchers ...*labels.Matcher) (storage.SeriesSet, error) { | ||
| chunks, err := q.store.Get(q.ctx, model.Time(q.mint), model.Time(q.maxt), matchers...) | ||
| func (q *chunkStoreQuerier) Select(sp *storage.SelectParams, matchers ...*labels.Matcher) (storage.SeriesSet, error) { | ||
| chunks, err := q.store.Get(q.ctx, model.Time(sp.Start), model.Time(sp.End), matchers...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this check that sp != nil ? Maybe it can't be today, but it seems safer to follow the general pattern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only call by querier.go (Select), which includes that check. Calling this with nil should panic IMO. The only "root" queriers are the ones in querier.go and unified_querier.go, where the nil check need to be.
|
This has been running in prod over the last couple of days and everything looks good! |
This will definitely helps with offset queries. Same was done on cortexproject/cortex#1012 Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
This will definitely helps with offset queries. Same was done on cortexproject/cortex#1012 Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
This will definitely helps with offset queries. Same was done on cortexproject/cortex#1012 Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
This will definitely helps with offset queries. Same was done on cortexproject/cortex#1012 Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
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>
TLDR; So turns out, if there was query like
up offset 4wbutstart-end = 15s, we would end up getting all the chunks fromstart-4wtoend. This PR makes sure only the relevant chunks are requested.This is because when we create a
Querierdue to TSDB constraints (and maybe for other reasons), we need a single querier for a query. Which means if weX / YwhereXhasoffset 4wandYdoesn't, theq.minTime, andq.maxTimewill need to span the entire4w.But this is mitigated by setting the appropriate parameters on
SelectParamswhich this PR makes sure we use.Relevant promQL code:
https://github.com/prometheus/prometheus/blob/master/promql/engine.go#L465-L467
https://github.com/prometheus/prometheus/blob/master/promql/engine.go#L472
https://github.com/prometheus/prometheus/blob/master/promql/engine.go#L491-L495