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

Emit Sentry warning and GCP log for sampled throttled queries #73620

Closed
wants to merge 1 commit into from

Conversation

xurui-c
Copy link
Member

@xurui-c xurui-c commented Jul 2, 2024

Allocation policies are our mechanism for doing traffic management for Snuba queries. Currently, the result of applying multiple allocation policies in the internal API is simply accept/reject/throttle.

In a previous PR, we emit a Sentry warning and a GCP log for every query throttled by Snuba's capacity management system. However, we quickly realized a large volume of queries were throttled.

To address this, we sample the throttled queries such that we will only emit a Sentry warning and a GCP log for every SAMPLING_FREQUENCYth throttled query for a given referrer. For example, if SAMPLING_FREQUENCY = 100, then we will emit the warning and log for every 100th throttled query for the same referrer.

@xurui-c xurui-c requested review from a team as code owners July 2, 2024 05:02
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 2, 2024
Copy link

codecov bot commented Jul 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.03%. Comparing base (d724281) to head (b5279a6).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #73620      +/-   ##
==========================================
- Coverage   78.03%   78.03%   -0.01%     
==========================================
  Files        6640     6640              
  Lines      297033   297040       +7     
  Branches    51152    51153       +1     
==========================================
+ Hits       231797   231800       +3     
- Misses      58961    58965       +4     
  Partials     6275     6275              
Files Coverage Δ
src/sentry/utils/snuba.py 89.75% <100.00%> (+0.10%) ⬆️

... and 2 files with indirect coverage changes

@xurui-c xurui-c marked this pull request as draft July 2, 2024 06:07
@xurui-c xurui-c marked this pull request as ready for review July 2, 2024 16:06
@xurui-c xurui-c requested a review from nhsiehgit July 2, 2024 16:29
@xurui-c
Copy link
Member Author

xurui-c commented Jul 3, 2024

close in favor of #73709

@xurui-c xurui-c closed this Jul 3, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jul 19, 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.

1 participant