Skip to content

Conversation

@xurui-c
Copy link
Member

@xurui-c xurui-c commented Aug 8, 2024

Allocation policies are our mechanism for doing traffic management for Snuba queries. Currently, we see a lot of warnings (Warning: Query from referrer ... is throttled) on Sentry Issues. This is because these queries are throttled due to being in the "warning zone"; however, we got feedback that this isn't actually actionable, so we're getting rid of them. We will only emit Sentry errors for rejected queries.

@xurui-c xurui-c marked this pull request as ready for review August 8, 2024 21:33
@xurui-c xurui-c requested review from a team as code owners August 8, 2024 21:33
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Aug 8, 2024
@sentry
Copy link

sentry bot commented Aug 8, 2024

🔍 Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

📄 File: src/sentry/utils/snuba.py

Function Unhandled Issue
_apply_cache_and_build_results RateLimitExceeded: Query on could not be run due to allocation policies, info: {'details': {'ConcurrentRateLimitAllo... ...
Event Count: 404
_apply_cache_and_build_results SnubaError: Unexpected EOF while reading bytes se...
Event Count: 28
_apply_cache_and_build_results SnubaError: Unexpected EOF while reading bytes se...
Event Count: 10
_apply_cache_and_build_results SnubaError: Unexpected EOF while reading bytes se...
Event Count: 7
_apply_cache_and_build_results UnqualifiedQueryError: validation failed for entity events: missing required conditions for project_id ...
Event Count: 2

Did you find this useful? React with a 👍 or 👎

Comment on lines -1121 to -1132
if (
"throttled_by" in quota_allowance_summary
and quota_allowance_summary["throttled_by"]
):
metrics.incr("snuba.client.query.throttle", tags={"referrer": referrer})
if random.random() < 0.01:
logger.warning(
"Warning: Query is throttled", extra={"response.data": response.data}
)
sentry_sdk.capture_message(
f"Warning: Query from referrer {referrer} is throttled", level="warning"
)
Copy link
Contributor

Choose a reason for hiding this comment

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

What if, instead of deleting this, we made it configurable-by-referrer and default off?

So if there is a product team interested in monitoring throttles we can quickly turn on warnings for their referrer, but we don't annoy certain people by filling the issue dashboard with throttle warnings that won't be dealt with.

Copy link

Choose a reason for hiding this comment

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

I think this is a good idea but knowing the scope (time and efforts) will be crucial. The configurability based on the referrer sounds good as it won't overpopulate the sentry dashboard. But my request is to take this suggestion as a follow-up in addition to the larger change @volokluev and @xurui-c were discussing. For now, I vote to merge the PR and begin scoping the improvements.

Copy link

@onkar onkar left a comment

Choose a reason for hiding this comment

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

LGTM, let's include the suggestion in the scoping of the larger work.

Comment on lines -1121 to -1132
if (
"throttled_by" in quota_allowance_summary
and quota_allowance_summary["throttled_by"]
):
metrics.incr("snuba.client.query.throttle", tags={"referrer": referrer})
if random.random() < 0.01:
logger.warning(
"Warning: Query is throttled", extra={"response.data": response.data}
)
sentry_sdk.capture_message(
f"Warning: Query from referrer {referrer} is throttled", level="warning"
)
Copy link

Choose a reason for hiding this comment

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

I think this is a good idea but knowing the scope (time and efforts) will be crucial. The configurability based on the referrer sounds good as it won't overpopulate the sentry dashboard. But my request is to take this suggestion as a follow-up in addition to the larger change @volokluev and @xurui-c were discussing. For now, I vote to merge the PR and begin scoping the improvements.

@xurui-c xurui-c merged commit be03c95 into master Aug 15, 2024
@xurui-c xurui-c deleted the rachel/noWarnings branch August 15, 2024 00:32
@github-actions github-actions bot locked and limited conversation to collaborators Aug 30, 2024
@xurui-c xurui-c changed the title Don't emit Sentry warnings for throttled queries to Snuba [CapMan self-serve] Don't emit Sentry warnings for throttled queries to Snuba Nov 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants