-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
ref(aci): remove detector usage in WorkflowFireHistory and action firing #103082
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
base: master
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,7 @@ | |
| from sentry.taskworker.retry import Retry | ||
| from sentry.utils import metrics | ||
| from sentry.utils.exceptions import timeout_grouping_context | ||
| from sentry.workflow_engine.models import Action, Detector | ||
| from sentry.workflow_engine.models import Action | ||
| from sentry.workflow_engine.tasks.utils import ( | ||
| build_workflow_event_data_from_activity, | ||
| build_workflow_event_data_from_event, | ||
|
|
@@ -23,7 +23,7 @@ | |
|
|
||
|
|
||
| def build_trigger_action_task_params( | ||
| action: Action, detector: Detector, event_data: WorkflowEventData | ||
| action: Action, event_data: WorkflowEventData | ||
| ) -> dict[str, object]: | ||
| """ | ||
| Build parameters for trigger_action task invocation. | ||
|
|
@@ -45,7 +45,6 @@ def build_trigger_action_task_params( | |
|
|
||
| return { | ||
| "action_id": action.id, | ||
| "detector_id": detector.id, | ||
| "workflow_id": getattr(action, "workflow_id", None), | ||
| "event_id": event_id, | ||
| "activity_id": activity_id, | ||
|
|
@@ -75,7 +74,7 @@ def trigger_action( | |
| group_state: GroupState, | ||
| has_reappeared: bool, | ||
| has_escalated: bool, | ||
| detector_id: int | None = None, | ||
| detector_id: int | None = None, # TODO: remove | ||
| ) -> None: | ||
| from sentry.notifications.notification_action.utils import should_fire_workflow_actions | ||
| from sentry.workflow_engine.processors.detector import get_detector_by_event | ||
|
|
@@ -90,11 +89,6 @@ def trigger_action( | |
|
|
||
| action = Action.objects.annotate(workflow_id=Value(workflow_id)).get(id=action_id) | ||
|
|
||
| # TODO: remove detector usage from this task | ||
| detector: Detector | None = None | ||
| if detector_id is not None: | ||
| detector = Detector.objects.get(id=detector_id) | ||
|
|
||
| if event_id is not None: | ||
| event_data = build_workflow_event_data_from_event( | ||
| event_id=event_id, | ||
|
|
@@ -118,8 +112,7 @@ def trigger_action( | |
| ) | ||
| raise ValueError("Exactly one of event_id or activity_id must be provided") | ||
|
|
||
| if detector is None: | ||
| detector = get_detector_by_event(event_data) | ||
| detector = get_detector_by_event(event_data) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Activity Actions Fail: Detector Type MismatchThe unconditional call to |
||
|
|
||
| metrics.incr( | ||
| "workflow_engine.tasks.trigger_action_task_started", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Invalid Events Trigger Failing Actions
Removing the detector existence check allows workflow fire histories to be created and actions to be triggered for events without detectors. Previously, events missing detectors were skipped with a warning. Now,
trigger_actiontasks will be queued and fail whenget_detector_by_eventraisesDetector.DoesNotExist, causing unnecessary task failures and retries instead of gracefully handling missing detectors upfront.