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

Better max_querier_bytes_read limit error messages #8916

Merged
merged 4 commits into from
Mar 28, 2023

Conversation

salvacorts
Copy link
Contributor

@salvacorts salvacorts commented Mar 28, 2023

What this PR does / why we need it:
In #8670 we introduced a new limit max_querier_bytes_read. When the limit was surpassed the following error message is printed:

query too large to execute on a single querier, either because parallelization is not enabled, the query is unshardable, or a shard query is too big to execute: (query: %s, limit: %s). Consider adding more specific stream selectors or reduce the time range of the query

As pointed out in this comment, a user would have a hard time figuring out whether the cause was parallelization is not enabled, the query is unshardable or a shard query is too big to execute.

This PR improves the error messaging for the max_querier_bytes_read limit to raise a different error for each of the causes above.

Which issue(s) this PR fixes:
Followup for #8670

Special notes for your reviewer:

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • CHANGELOG.md updated
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/upgrading/_index.md

@salvacorts salvacorts marked this pull request as ready for review March 28, 2023 09:20
@salvacorts salvacorts requested a review from a team as a code owner March 28, 2023 09:20
Copy link
Contributor

@dannykopping dannykopping left a comment

Choose a reason for hiding this comment

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

Looks great! Once we start using errata then we can link to the specific settings to be adjusted, and add explanations about what sharded queries are, etc. It's a bit difficult to fit that into our current error handling.

For now though this LGTM, i've left a couple small comments

Comment on lines 42 to 43
limErrQuerierTooManyBytesShardableTmpl = "not shardable query too large to execute on a single querier: (query: %s, limit: %s). Consider adding more specific stream selectors or reduce the time range of the query"
limErrQuerierTooManyBytesUnshardableTmpl = "shard query is too big to execute on a single querier: (query: %s, limit: %s). Consider adding more specific stream selectors or reduce the time range of the query"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think these two might be mixed up, based on the name of the const

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree but I think it's the most representative name. What about limErrQuerierTooManyBytesUNshardableTmpl, note the capital N

Copy link
Contributor

Choose a reason for hiding this comment

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

What i mean is:

UnshardableTmpl => shard query is too big
ShardableTmpl => not shardable query too large

That seems backwards to me?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gotcha. As Sandeep pointed out. Those were the other way around. Fixed now.

pkg/querier/queryrange/limits.go Outdated Show resolved Hide resolved
Copy link
Contributor

@sandeepsukhani sandeepsukhani left a comment

Choose a reason for hiding this comment

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

LGTM with minor nits

Comment on lines 42 to 43
limErrQuerierTooManyBytesShardableTmpl = "not shardable query too large to execute on a single querier: (query: %s, limit: %s). Consider adding more specific stream selectors or reduce the time range of the query"
limErrQuerierTooManyBytesUnshardableTmpl = "shard query is too big to execute on a single querier: (query: %s, limit: %s). Consider adding more specific stream selectors or reduce the time range of the query"
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel error messages are not aligning with the names of the variables

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! Good catch.

requiredLabelsErrTmpl = "stream selector is missing required matchers [%s], labels present in the query were [%s]"
limErrQueryTooManyBytesTmpl = "the query would read too many bytes (query: %s, limit: %s). Consider adding more specific stream selectors or reduce the time range of the query"
limErrQuerierTooManyBytesTmpl = "query too large to execute on a single querier: (query: %s, limit: %s). Consider adding more specific stream selectors, reduce the time range of the query, or adjust parallelization settings"
limErrQuerierTooManyBytesShardableTmpl = "not shardable query too large to execute on a single querier: (query: %s, limit: %s). Consider adding more specific stream selectors or reduce the time range of the query"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
limErrQuerierTooManyBytesShardableTmpl = "not shardable query too large to execute on a single querier: (query: %s, limit: %s). Consider adding more specific stream selectors or reduce the time range of the query"
limErrQuerierTooManyBytesUnshardableTmpl = "un-shardable query too large to execute on a single querier: (query: %s, limit: %s). Consider adding more specific stream selectors or reducing the time range of the query"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

limErrQueryTooManyBytesTmpl = "the query would read too many bytes (query: %s, limit: %s). Consider adding more specific stream selectors or reduce the time range of the query"
limErrQuerierTooManyBytesTmpl = "query too large to execute on a single querier: (query: %s, limit: %s). Consider adding more specific stream selectors, reduce the time range of the query, or adjust parallelization settings"
limErrQuerierTooManyBytesShardableTmpl = "not shardable query too large to execute on a single querier: (query: %s, limit: %s). Consider adding more specific stream selectors or reduce the time range of the query"
limErrQuerierTooManyBytesUnshardableTmpl = "shard query is too big to execute on a single querier: (query: %s, limit: %s). Consider adding more specific stream selectors or reduce the time range of the query"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
limErrQuerierTooManyBytesUnshardableTmpl = "shard query is too big to execute on a single querier: (query: %s, limit: %s). Consider adding more specific stream selectors or reduce the time range of the query"
limErrQuerierTooManyBytesShardableTmpl = "sharded query too large to execute on a single querier: (query: %s, limit: %s). Consider adding more specific stream selectors or reducing the time range of the query"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@dannykopping dannykopping left a comment

Choose a reason for hiding this comment

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

LGTM with one more tiny nit, thanks!

pkg/querier/queryrange/limits.go Outdated Show resolved Hide resolved
@salvacorts salvacorts merged commit 336e08f into main Mar 28, 2023
@salvacorts salvacorts deleted the salvacorts/max-querier-size-messaging branch March 28, 2023 10:06
@salvacorts salvacorts changed the title Salvacorts/max querier size messaging Better max_querier_bytes_read limit error messages Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants