-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
feat(workflows): start using the action filters cache #111817
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
Changes from all 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 |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ | |
| from sentry.models.environment import Environment | ||
| from sentry.services.eventstore.models import GroupEvent | ||
| from sentry.workflow_engine.buffer.batch_client import DelayedWorkflowClient, DelayedWorkflowItem | ||
| from sentry.workflow_engine.caches.action_filters import get_action_filters_by_workflows | ||
| from sentry.workflow_engine.caches.workflow import get_workflows_by_detectors | ||
| from sentry.workflow_engine.models import DataConditionGroup, Detector, DetectorWorkflow, Workflow | ||
| from sentry.workflow_engine.models.data_condition import DataCondition | ||
|
|
@@ -269,12 +270,24 @@ def evaluate_workflows_action_filters( | |
| queue_items_by_workflow.keys() | ||
| ) | ||
|
|
||
| action_conditions_to_workflow: dict[DataConditionGroup, Workflow] = { | ||
| wdcg.condition_group: wdcg.workflow | ||
| for wdcg in WorkflowDataConditionGroup.objects.select_related( | ||
| "workflow", "condition_group" | ||
| ).filter(workflow__in=all_workflows) | ||
| } | ||
| organization = event_data.event.project.organization | ||
|
|
||
| action_conditions_to_workflow: dict[DataConditionGroup, Workflow] = {} | ||
|
|
||
| if features.has("organizations:workflow-engine-action-filters-cache", organization): | ||
|
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. mind adding a test to the processing method to make sure that this is working as expected when it's enabled? (that should help guard against any rollout concerns and flipping the switch later. we would ideally be testing the majority of the logic in the tests for evaluating action filters) |
||
| all_workflows_lookup: dict[int, Workflow] = {w.id: w for w in all_workflows} | ||
| action_filters_by_workflows = get_action_filters_by_workflows(all_workflows) | ||
|
|
||
| for workflow_id, dcgs in action_filters_by_workflows.items(): | ||
| for dcg in dcgs: | ||
| action_conditions_to_workflow[dcg] = all_workflows_lookup[workflow_id] | ||
| else: | ||
| action_conditions_to_workflow = { | ||
| wdcg.condition_group: wdcg.workflow | ||
| for wdcg in WorkflowDataConditionGroup.objects.select_related( | ||
| "workflow", "condition_group" | ||
| ).filter(workflow__in=all_workflows) | ||
| } | ||
|
|
||
| filtered_action_groups: set[DataConditionGroup] = set() | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.