Repository navigation
fix(sentry): reset the repetition throttle on quiet, not on the clock - #3428
Draft
vpetersson-bot wants to merge 2 commits into
Draft
vpetersson-bot wants to merge 2 commits into
vpetersson-bot wants to merge 2 commits into
Conversation
The per-issue throttle counted occurrences over a fixed one-hour window, so a device whose loop never pauses restarted the 1, 2, 4, 8, ... sequence every hour and got a fresh budget with it. - Key the reset on the issue going quiet for a window instead, so the count spans the whole run of activity. - The board behind ANTHIAS-3H emitted ~53/hour for 33 unbroken hours: 198 events under the fixed window, 11 under this change. - Evict throttle keys by least-recently-seen rather than by the oldest window start. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
mypy rejects `settings.time` because the settings module does not re-export `time`. Patching by import path targets the same object without reaching through the module attribute. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Issues Fixed
The per-issue repetition throttle added in #3400 thins a looping
device down to the powers of two, but it counted over a fixed
one-hour window. A loop that never pauses therefore restarted the
1, 2, 4, 8, ...sequence on every hour boundary and collected afresh budget with it —
O(log n)per hour, which for a loop thatdoes not end is just a slower
O(n).That is the shape of the traffic the throttle exists to stop. The
board behind
ANTHIAS-3Hproduced 1,761 copies of one error over 33unbroken hours, about 53 an hour:
Description
_throttlednow resets a key's count only after the issue hasbeen quiet for a whole window, so the count spans the run of
activity rather than the wall clock. The stored timestamp becomes
"last seen" instead of "window started at".
_evict_throttle_keysdrops keys by least-recently-seen, whichfalls out of the same change and is the better eviction order.
more sparsely the longer it runs, so its
lastSeenlags. An issuecarrying a
throttle.occurrencetag of 262,144 still plainlyreads as "constantly happening", and the quota it would otherwise
spend is what silences every other issue in the project.
No behaviour change for the common case — a one-off error, or an
issue that recurs with gaps longer than the window, is unaffected.
tests/test_sentry.pygains a test that drives the throttle throughthat real 53/hour-for-33-hours profile against a simulated clock and
asserts 11 kept events; it fails at 198 without the fix.
Checklist
Not hardware-tested: this is a pure in-process filter in
settings.pywith no device-specific behaviour, covered by unittests. Full host suite run locally —
tests/test_sentry.py51/51,and the failure set across the rest of the suite is byte-identical
with and without this change.
🤖 Generated with Claude Code