Repository navigation
Conversation
|
No findings on the latest commit. |
417639d to
09f6bd3
Compare
saponifi3d
left a comment
There was a problem hiding this comment.
It'd be great if we could DRY the code up a bit more with a helper method for triggering these actions; that way we could encapsulate all the different aspects of triggering an action within workflow engine.
| enqueue_workflows(batch_client, delayed_items) | ||
|
|
||
| actions, action_to_workflow_id = filter_recently_fired_workflow_actions( | ||
| actions, action_to_workflow_id, eligible_workflow_ids = filter_recently_fired_workflow_actions( |
There was a problem hiding this comment.
🤔 should we move all of this code into a shared method so we can reduce the code replication between process_workflows and processing the delayed workflows?
Something like:
# processors/action.py
def trigger_actions(action_groups, event_data, *, is_delayed, start_timestamp) -> TriggeredActions:
actions, action_to_workflow_id, eligible_workflow_ids = filter_recently_fired_workflow_actions(action_groups, event_data)
if not actions:
return TriggeredActions.empty()
histories = create_workflow_fire_histories(
eligible_workflow_ids,
event_data,
is_delayed=is_delayed,
start_timestamp=start_timestamp,
)
workflow_notification_mapping = {h.workflow_id: str(h.notification_uuid) for h in histories}
fire_actions(actions, event_data, workflow_notification_mapping, action_to_workflow_id)
return TriggeredActions(actions, action_to_workflow_id, histories)(probably means changes elsewhere if you want to go with this method as is).
There was a problem hiding this comment.
sure, added trigger_actions in src/sentry/workflow_engine/processors/action.py
| is_delayed: bool = False, | ||
| start_timestamp: datetime | None = None, | ||
| *, | ||
| eligible_workflow_ids: Collection[WorkflowId], |
There was a problem hiding this comment.
nit: this method signature feels a little awkward that there's a required keyword-only argument after optional positional arguments. maybe this should just be keywords so the argument order doesn't matter?
9e8050e to
f405b33
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Share history creation and dispatch across immediate and delayed evaluations. Record every eligible workflow for a shared action and dispatch once with its selected workflow’s notification UUID. Refs ISWF-3705
Materialize the scoped workflow IDs for metrics and history writes. Pin the eligible history IDs when one workflow sharing an action is throttled. Refs ISWF-3705
ccdf440 to
89b03ef
Compare
f405b33 to
7b89c6d
Compare
Record a fire-history row for each workflow whose conditions and configured action frequency passed. Previously, when two workflows shared an action, one could receive a history row even though its conditions failed or it was throttled.
Immediate and delayed processing now share the same history and dispatch logic. If both workflows qualify, each gets a history row and the shared action is dispatched once with the selected workflow’s notification UUID. The history writer checks the supplied workflow IDs against the event’s organization.
Stacked on #131093, which supplies the eligible actions and their workflow attribution.
Refs ISWF-3705. Tech spec