feat(notifications): Add notification data and renderer for metric alerts#111674
1 issue
sentry-backend-bugs: Found 1 issue (1 high)
High
QuerySubscription.DoesNotExist not handled in get_metric_issue_context call - `src/sentry/notifications/platform/slack/renderers/metric_alert.py:32-33`
The call to MetricAlertNotificationData.get_metric_issue_context(event) at line 32-33 internally calls QuerySubscription.objects.get() without exception handling. If the subscription was deleted between notification data creation and rendering, this raises QuerySubscription.DoesNotExist and crashes the entire render operation. This matches the stale reference pattern (Check 2) seen in 81 production issues with 1.4M events.
Also found at:
src/sentry/notifications/platform/templates/metric_alert.py:150-151
Duration: 2m 8s · Tokens: 914.5k in / 10.1k out · Cost: $1.32 (+extraction: $0.01, +merge: $0.00)
Annotations
Check failure on line 33 in src/sentry/notifications/platform/slack/renderers/metric_alert.py
sentry-warden / warden: sentry-backend-bugs
QuerySubscription.DoesNotExist not handled in get_metric_issue_context call
The call to `MetricAlertNotificationData.get_metric_issue_context(event)` at line 32-33 internally calls `QuerySubscription.objects.get()` without exception handling. If the subscription was deleted between notification data creation and rendering, this raises `QuerySubscription.DoesNotExist` and crashes the entire render operation. This matches the stale reference pattern (Check 2) seen in 81 production issues with 1.4M events.
Check failure on line 151 in src/sentry/notifications/platform/templates/metric_alert.py
sentry-warden / warden: sentry-backend-bugs
[ED9-JBN] QuerySubscription.DoesNotExist not handled in get_metric_issue_context call (additional location)
The call to `MetricAlertNotificationData.get_metric_issue_context(event)` at line 32-33 internally calls `QuerySubscription.objects.get()` without exception handling. If the subscription was deleted between notification data creation and rendering, this raises `QuerySubscription.DoesNotExist` and crashes the entire render operation. This matches the stale reference pattern (Check 2) seen in 81 production issues with 1.4M events.