Skip to content

ref(uptime): Detector always exists #94571

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

evanpurkhiser
Copy link
Member

No description provided.

@evanpurkhiser evanpurkhiser requested a review from a team as a code owner June 27, 2025 20:51
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 27, 2025
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Task Crashes on Missing Detector

The broken_monitor_checker task crashes with an unhandled Detector.DoesNotExist exception when get_detector() is called for an UptimeSubscription that lacks a detector. This regression occurred because the assert detector check was removed, and get_detector() now raises an exception instead of returning None. The crash prevents the task from processing remaining subscriptions and disabling other broken monitors. The task should handle this exception to gracefully skip subscriptions without detectors.

src/sentry/uptime/subscriptions/tasks.py#L231-L235

):
detector = get_detector(uptime_subscription)
if detector.config["mode"] == UptimeMonitorMode.AUTO_DETECTED_ACTIVE:
disable_uptime_detector(detector)
count += 1

Fix in Cursor


Bug: Unhandled Exceptions Break Delete Functionality

Removing assert detector without adding exception handling for get_detector() (which now raises Detector.DoesNotExist) causes unhandled exceptions, leading to crashes if the detector does not exist. This breaks functionality, including the delete endpoint.

src/sentry/uptime/subscriptions/subscriptions.py#L326-L327

detector = get_detector(uptime_monitor.uptime_subscription)

src/sentry/uptime/endpoints/project_uptime_alert_details.py#L124-L125

"""
detector = get_detector(uptime_subscription.uptime_subscription)

Fix in Cursor


Was this report helpful? Give feedback by reacting with 👍 or 👎

Copy link

codecov bot commented Jun 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #94571   +/-   ##
=======================================
  Coverage   87.94%   87.94%           
=======================================
  Files       10405    10405           
  Lines      602418   602387   -31     
  Branches    23446    23446           
=======================================
- Hits       529803   529784   -19     
+ Misses      72110    72098   -12     
  Partials      505      505           

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.

1 participant