-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
feat(aci): add WorkflowActionGroupStatus table #91993
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?
Conversation
This PR has a migration; here is the generated SQL for for --
-- Create model WorkflowActionGroupStatus
--
CREATE TABLE "workflow_engine_workflowactiongroupstatus" ("id" bigint NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "date_updated" timestamp with time zone NOT NULL, "date_added" timestamp with time zone NOT NULL, "action_id" bigint NOT NULL, "group_id" bigint NOT NULL, "workflow_id" bigint NOT NULL, CONSTRAINT "workflow_engine_uniq_workflow_action_group" UNIQUE ("workflow_id", "action_id", "group_id"));
ALTER TABLE "workflow_engine_workflowactiongroupstatus" ADD CONSTRAINT "workflow_engine_work_action_id_b4d629d5_fk_workflow_" FOREIGN KEY ("action_id") REFERENCES "workflow_engine_action" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "workflow_engine_workflowactiongroupstatus" VALIDATE CONSTRAINT "workflow_engine_work_action_id_b4d629d5_fk_workflow_";
ALTER TABLE "workflow_engine_workflowactiongroupstatus" ADD CONSTRAINT "workflow_engine_work_group_id_89305015_fk_sentry_gr" FOREIGN KEY ("group_id") REFERENCES "sentry_groupedmessage" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "workflow_engine_workflowactiongroupstatus" VALIDATE CONSTRAINT "workflow_engine_work_group_id_89305015_fk_sentry_gr";
ALTER TABLE "workflow_engine_workflowactiongroupstatus" ADD CONSTRAINT "workflow_engine_work_workflow_id_8110df1d_fk_workflow_" FOREIGN KEY ("workflow_id") REFERENCES "workflow_engine_workflow" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "workflow_engine_workflowactiongroupstatus" VALIDATE CONSTRAINT "workflow_engine_work_workflow_id_8110df1d_fk_workflow_";
CREATE INDEX CONCURRENTLY "workflow_engine_workflowactiongroupstatus_action_id_b4d629d5" ON "workflow_engine_workflowactiongroupstatus" ("action_id");
CREATE INDEX CONCURRENTLY "workflow_engine_workflowactiongroupstatus_group_id_89305015" ON "workflow_engine_workflowactiongroupstatus" ("group_id");
CREATE INDEX CONCURRENTLY "workflow_engine_workflowactiongroupstatus_workflow_id_8110df1d" ON "workflow_engine_workflowactiongroupstatus" ("workflow_id"); |
Codecov ReportAll modified and coverable lines are covered by tests ✅
|
What is the plan for the switchover? Are we going to double write data to both tables for some time? I am not very familiar with workflows, but don't we need historic data in the new table, which would still require us to do a backfill? |
Stores when a workflow action last fired for a Group. | ||
""" | ||
|
||
__relocation_scope__ = RelocationScope.Excluded |
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.
If an account is relocated, do we not want the history of their alert workflows to be preserved?
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.
hmm this is the workflow engine equivalent to GroupRuleStatus
which is excluded from relocation. i'm not entirely sure why, though
@vgrozdanic I will dual write to both tables and then drop the |
Rather than adding a non-nullable
Workflow
FK column toActionGroupStatus
and backfilling it, we can just create a new table and switch over, eventually droppingActionGroupStatus
.We need the
Workflow
in order to enforce workflow frequency per action. In the future, actions may be shared between multiple workflows.Example:
Workflow A: frequency 5 min
Workflow B: frequency 30 min
Workflow A should fire Action A every 5 min for a group. Workflow B should fire Action A every 30 min for that same group. If we don't have Workflow on
ActionGroupStatus
, then both workflows will "share" the most recent firing (read from the same row) and the interval can get wonky. Workflow B may not fire at 30 minute intervals if Workflow A keeps triggering Action A.