fix(alerts): Populate metric_alert webhook actions for native monitors#118388
Draft
Christinarlong wants to merge 1 commit into
Draft
fix(alerts): Populate metric_alert webhook actions for native monitors#118388Christinarlong wants to merge 1 commit into
Christinarlong wants to merge 1 commit into
Conversation
When a Metric Monitor fires and notifies a Sentry App, the metric_alert webhook payload had an empty triggers[].actions array, so the Sentry App action and its configured settings never reached the app. The webhook payload is rebuilt from workflow_engine models by WorkflowEngineDataConditionSerializer, which attached actions to a trigger only when the workflow's action-filter DataConditionGroup contained an ISSUE_PRIORITY_GREATER_OR_EQUAL condition matching the trigger's priority. Alert rules migrated from the legacy system always create that condition, but natively-created connected alerts seed their action filter with no conditions, so nothing matched and the actions were dropped. Treat an action filter with no priority gate as firing for any priority, so its actions are attributed to the detector's triggers. Fixes GH-118042 Refs ENG-7988 Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a Metric Monitor (workflow_engine Detector) fires and notifies a Sentry App, the
metric_alertwebhook payload had an emptydata.metric_alert.alert_rule.triggers[].actionsarray — so the Sentry App action and its configured settings (e.g. achannelselect) never reached the app.The payload is rebuilt from workflow_engine models by
WorkflowEngineDataConditionSerializer.get_attrs, which attaches actions to a trigger only when the workflow's action-filterDataConditionGroupcontains anISSUE_PRIORITY_GREATER_OR_EQUALcondition whosecomparisonmatches the trigger's priority (HIGH=75/MEDIUM=50):automationBuilderContext.tsx). With no priority condition, nothing matched and the actions were dropped →actions: []. ❌Fix
Track whether each action-filter DCG gates on priority at all, and treat a DCG with no priority gate as firing for any priority — so its actions are attributed to the detector's triggers. Migrated rules still take the priority-match branch and are unchanged; only priority-less (native) filters take the new path.
A priority-less filter matches all of the detector's triggers, which is semantically correct (an empty filter fires for any priority); the webhook's top-level status still identifies which trigger fired.
Fixes #118042
Refs ENG-7988