-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
chore(aci): add WorkflowGroupStatus model #83071
Conversation
This PR has a migration; here is the generated SQL for --
-- Create model WorkflowGroupStatus
--
CREATE TABLE "workflow_engine_workflowgroupstatus" ("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, "status" smallint NOT NULL CHECK ("status" >= 0), "group_id" bigint NOT NULL, "workflow_id" bigint NOT NULL, CONSTRAINT "workflow_engine_uniq_workflow_group" UNIQUE ("workflow_id", "group_id"));
ALTER TABLE "workflow_engine_workflowgroupstatus" ADD CONSTRAINT "workflow_engine_work_group_id_b90bf29b_fk_sentry_gr" FOREIGN KEY ("group_id") REFERENCES "sentry_groupedmessage" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "workflow_engine_workflowgroupstatus" VALIDATE CONSTRAINT "workflow_engine_work_group_id_b90bf29b_fk_sentry_gr";
ALTER TABLE "workflow_engine_workflowgroupstatus" ADD CONSTRAINT "workflow_engine_work_workflow_id_a719e7cf_fk_workflow_" FOREIGN KEY ("workflow_id") REFERENCES "workflow_engine_workflow" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "workflow_engine_workflowgroupstatus" VALIDATE CONSTRAINT "workflow_engine_work_workflow_id_a719e7cf_fk_workflow_";
CREATE INDEX CONCURRENTLY "workflow_engine_workflowgroupstatus_group_id_b90bf29b" ON "workflow_engine_workflowgroupstatus" ("group_id");
CREATE INDEX CONCURRENTLY "workflow_engine_workflowgroupstatus_workflow_id_a719e7cf" ON "workflow_engine_workflowgroupstatus" ("workflow_id"); |
❌ 8 Tests Failed:
View the top 3 failed tests by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
🚨 Warning: This pull request contains Frontend and Backend changes! It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently. Have questions? Please ask in the |
i think i'm missing an updated |
|
||
|
||
@region_silo_model | ||
class WorkflowGroupStatus(DefaultFieldsModel): |
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.
Is the plan here to use date_updated
as the equivalent of last_active
?
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.
yes, is that possible/wise? i believe you can manually update it with update()
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.
I think it's ok... we'd only really be updating it in one case. Maybe just test locally (write a throwaway test?) to see if you can do the equivalent of
updated = (
GroupRuleStatus.objects.filter(id=status.id)
.exclude(last_active__gt=freq_offset)
.update(last_active=now)
)
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.
@saponifi3d We discussed possibly needing to keep the status by action instead of workflow - just wanted to make sure that didn't get missed
@wedamija - nah, didn't miss it, we're just kicking the can down the road on tracking the history of each action call. (we'll still emit a metric for SLOs etc though). In the end, we were able to support everything in the current design through open periods, but need this table to support the the frequency check. |
moving to #83125 because making a new migration and generating snapshots is a headache in the same PR |
Add workflow engine equivalent of
GroupRuleStatus
to enforce the number of times a workflow can fire for a group in a period of time. This "period" is thefrequency
key inworkflow.config
.