Skip to content

Conversation

@kcons
Copy link
Member

@kcons kcons commented Nov 20, 2025

Rather than failing on the first try, attempting to retry up to twice will make minor Seer availability blips non-events.
Worst-case added backoff should be 1.5s, which I think is tolerable in all contexts and generally preferable to failure.

@kcons kcons requested a review from ceorourke November 20, 2025 23:08
@kcons kcons requested a review from a team as a code owner November 20, 2025 23:08
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 20, 2025
timeout=settings.SEER_ANOMALY_DETECTION_TIMEOUT,
)

SEER_RETRIES = Retry(total=2, backoff_factor=0.5)
Copy link

Choose a reason for hiding this comment

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

Bug: The urllib3.Retry object is not configured to retry on TimeoutError exceptions, causing immediate failure instead of retries.
Severity: MEDIUM | Confidence: High

🔍 Detailed Analysis

The urllib3.Retry object, initialized with Retry(total=2, backoff_factor=0.5), does not automatically retry on TimeoutError exceptions. By default, it only retries on connection-related errors and specific HTTP status codes. Consequently, if a TimeoutError occurs during a Seer API call, the request will fail immediately without retrying, which contradicts the pull request's stated intention to handle minor availability blips.

💡 Suggested Fix

Configure the urllib3.Retry object to explicitly retry on TimeoutError by either adding TimeoutError to raise_on_status or raise_on_connection_error (if applicable) or by implementing a custom retry strategy.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: src/sentry/seer/anomaly_detection/get_anomaly_data.py#L35

Potential issue: The `urllib3.Retry` object, initialized with `Retry(total=2,
backoff_factor=0.5)`, does not automatically retry on `TimeoutError` exceptions. By
default, it only retries on connection-related errors and specific HTTP status codes.
Consequently, if a `TimeoutError` occurs during a Seer API call, the request will fail
immediately without retrying, which contradicts the pull request's stated intention to
handle minor availability blips.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference_id: 2866257

@kcons kcons merged commit 21f5bb0 into master Nov 21, 2025
67 checks passed
@kcons kcons deleted the kcons/getanom branch November 21, 2025 00:32
Gust-feng added a commit to Gust-feng/sentry that referenced this pull request Nov 21, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Dec 6, 2025
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.

3 participants