Skip to content

Commit 97bb17a

Browse files
authored
fix(aci): Cache feature checks to keep span counts low (#95305)
delayed_workflows traces that are timed out or close to it are frequently at the 1000 span limit, which means they're incomplete. Caching features.has calls when they aren't expected to change avoids logging 1 (or potentially more) spans per group that ultimately isn't interesting to our performance work, making investigations easier.
1 parent cfe2dc2 commit 97bb17a

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/sentry/workflow_engine/processors/delayed_workflow.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,14 @@ def fire_actions_for_groups(
628628
).filter(workflow__in=workflows)
629629
}
630630

631+
# Feature check caching to keep us within the trace budget.
632+
should_trigger_actions = features.has(
633+
"organizations:workflow-engine-trigger-actions", organization
634+
)
635+
should_trigger_actions_async = features.has(
636+
"organizations:workflow-engine-action-trigger-async", organization
637+
)
638+
631639
total_actions = 0
632640
with track_batch_performance(
633641
"workflow_engine.delayed_workflow.fire_actions_for_groups.loop",
@@ -701,15 +709,9 @@ def fire_actions_for_groups(
701709
)
702710
total_actions += len(filtered_actions)
703711

704-
if features.has(
705-
"organizations:workflow-engine-trigger-actions",
706-
organization,
707-
):
712+
if should_trigger_actions:
708713
for action in filtered_actions:
709-
if features.has(
710-
"organizations:workflow-engine-action-trigger-async",
711-
organization,
712-
):
714+
if should_trigger_actions_async:
713715
task_params = build_trigger_action_task_params(
714716
action, detector, workflow_event_data
715717
)

0 commit comments

Comments
 (0)