Skip to content
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

add flag max query samples #1369

Merged
merged 1 commit into from
Jan 24, 2020
Merged

Conversation

yeya24
Copy link
Contributor

@yeya24 yeya24 commented Aug 3, 2019

Signed-off-by: yeya24 yb532204897@gmail.com

  • [] CHANGELOG entry if change is relevant to the end user.

Changes

fix #703

Verification

@GiedriusS
Copy link
Member

GiedriusS commented Aug 6, 2019

Thanks for working on this! Very appreciated. In the original issue @bwplotka says:

At first glance, yes as we do max sample verify while we are iterating over messages from stream, so we will not fetch more much more samples than query.max-samples define.

Is this really true? Could you or someone point me to code where this happens? I'm afraid that the PromQL engine only sees the "end results", after the Select() gets everything from StoreAPI nodes and, optionally, deduplicates them.

@GiedriusS
Copy link
Member

@yeya24 do you have any comments on my previous question? @bwplotka WDYT?

@yeya24
Copy link
Contributor Author

yeya24 commented Oct 30, 2019

@yeya24 do you have any comments on my previous question? @bwplotka WDYT?

I am sorry that I forget this pr... I will look through it further and respond it

@GiedriusS GiedriusS mentioned this pull request Nov 25, 2019
2 tasks
@stale
Copy link

stale bot commented Jan 11, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 11, 2020
@stale stale bot closed this Jan 18, 2020
@yeya24
Copy link
Contributor Author

yeya24 commented Jan 21, 2020

/reopen

@bwplotka
Copy link
Member

Just ask us (: Or help us maintaining Thanos and become Thanos maintainer or Triage (: Would you be interested @yeya24 ? (:

@bwplotka bwplotka reopened this Jan 21, 2020
@stale stale bot removed the stale label Jan 21, 2020
Signed-off-by: yeya24 <yb532204897@gmail.com>
Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Thanks!

@bwplotka bwplotka merged commit 912e101 into thanos-io:master Jan 24, 2020
@GiedriusS
Copy link
Member

GiedriusS commented Jan 24, 2020

What about my comment? AIUI this limit is only being applied after the results from Select() have been retrieved. The Select() called is this one: https://github.com/thanos-io/thanos/blob/master/pkg/query/querier.go#L168. Inside of it, we already retrieve all of the results and only then pass them on to the PromQL engine which actually applies those limits. I tested out with --query.max-samples=1 and a query sum(up) by (job). Added a small fmt.Println there: fmt.Println(len(resp.seriesSet)) and it prints out numbers like 7596 which means AIUI that those series have been loaded but they haven't been passed to the engine itself. After that, I get that error but that data is still in my querier. Shouldn't we document this better at the very least so that we wouldn't mislead our users? Or perhaps I am wrong.

@yeya24
Copy link
Contributor Author

yeya24 commented Jan 24, 2020

@GiedriusS Thanks for the comment. I think you are right, these samples from Select() are already in the Querier's memory and the help message in this flag is quite misleading. What about Maximum number of samples in a single query evaluation? Do you think should we change the name as well?

@bwplotka
Copy link
Member

Sorry, I totally missed this. You are right @GiedriusS I believe in this case we even have to calculate by estimating chunks again when they appear on stream... 🤔

@GiedriusS
Copy link
Member

Yep, that's why I was hesitant to merge this. Maybe let's revert this current version and remake it into something that uses a counter on the Recv() part? I feel like no matter how we would name this, it wouldn't bring much benefit because AIUI the main objective is to prevent OOM situations but currently it almost doesn't help with that :/ and I just want to avoid getting lots of tickets on github about how this option doesn't work

@bwplotka
Copy link
Member

Agree - let's revert. Sorry my bad - premature approve.

bwplotka added a commit that referenced this pull request Jan 25, 2020
@GiedriusS
Copy link
Member

Agree - let's revert. Sorry my bad - premature approve.

It's ok, no worries! 😄

bwplotka added a commit that referenced this pull request Jan 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose query.max-samples flag for Thanos Querier.
3 participants