Skip to content

fix(seer): Handle non-2xx HTTP responses from severity-score endpoint - #125145

Open
sentry[bot] wants to merge 2 commits into
masterfrom
seer/fix/seer-severity-http-error
Open

sentry[bot] wants to merge 2 commits into
masterfrom
seer/fix/seer-severity-http-error

Conversation

@sentry

@sentry sentry Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

This PR fixes a JSONDecodeError that occurred when the Seer /v0/issues/severity-score endpoint returned a non-2xx HTTP status code (e.g., 503 Service Unavailable).

Previously, the _get_severity_score() function in src/sentry/event_manager.py would attempt to parse response.data with orjson.loads() immediately after make_severity_score_request(), without first checking the HTTP status code. When Seer returned an error status, the response body often contained an HTML error page, leading to a JSONDecodeError.

The fix introduces a check for response.status >= 400 before attempting JSON parsing. If an error status is detected, an Exception is raised. This exception is then caught by the existing except Exception block, which gracefully handles the microservice error by setting the reason to microservice_error and incrementing relevant metrics, thus preventing the JSONDecodeError.

Additionally, a new metric tag microservice_http_error is added to distinguish these specific HTTP errors from other unknown microservice errors. A new test case has also been added to tests/sentry/event_manager/test_severity.py to cover this scenario.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Fixes SENTRY-5M0K

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@sentry
sentry Bot requested a review from a team as a code owner September 21, 2026 22:40
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Sep 21, 2026

This branch has not been deployed

No deployments
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.

0 participants