Skip to content

fix(circuit-breaker): Allow requests when the quota check fails - #131296

Merged
Starrao123 merged 1 commit into
masterfrom
vinayakrao/infreng-880-circuit-breaker-fail-open
Nov 16, 2026
Merged

Starrao123 merged 1 commit into
masterfrom
vinayakrao/infreng-880-circuit-breaker-fail-open

Conversation

@Starrao123

Copy link
Copy Markdown
Contributor

Refs INFRENG-883

CircuitBreaker.should_allow_request now lets the request through when its quota check can't reach Redis, as it already does when the state read fails.

The quota check had no error handling, so a Redis error reached the caller. In Seer similarity grouping that fails save_event and the event is lost, which happened 3 times in US in the last 90 days. We're moving the ratelimiter cluster these breakers use to Valkey, and the cutover makes these errors more likely.

This applies to every CircuitBreaker user, not only Seer.

Tests: pytest tests/sentry/utils/test_circuit_breaker2.py

should_allow_request already lets traffic through when it can't read the breaker state. The
quota check that runs next had no error handling, so a Redis error there reached the caller. For
Seer grouping that fails save_event and the event is lost.

Refs INFRENG-883
@linear-code

linear-code Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

INFRENG-880

INFRENG-883

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 16, 2026
@Starrao123
Starrao123 requested a review from a team November 16, 2026 17:10
@Starrao123
Starrao123 marked this pull request as ready for review November 16, 2026 17:10
@Starrao123
Starrao123 requested a review from a team as a code owner November 16, 2026 17:10
Comment thread src/sentry/utils/circuit_breaker2.py Resolved
@Starrao123
Starrao123 merged commit 303a746 into master Nov 16, 2026
74 checks passed
@Starrao123
Starrao123 deleted the vinayakrao/infreng-880-circuit-breaker-fail-open branch November 16, 2026 19:56
Starrao123 added a commit that referenced this pull request Nov 16, 2026
… when redis fails (#131364)

`CircuitBreaker.record_error` and `record_success` now log and return
when their Redis calls fail, as the state read and write already do.

Callers run these while handling their own request, so a Redis error
replaced their result. Seer similarity raised instead of returning no
matches, and the API gateway proxy and `gpu_crash` raised instead of
returning their fallback.

If the trip-log read fails after the breaker decides to trip, it still
trips.

An error or success that fails to write isn't counted. Enforcement
doesn't change, since `should_allow_request` already lets requests
through when Redis fails (#131296).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants