Skip to content
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

feat(ACI): Add lookup table for data conditions and alert rule triggers #88730

Merged
merged 4 commits into from
Apr 3, 2025

Conversation

ceorourke
Copy link
Member

Create a lookup table for "detector trigger" data conditions and alert rule triggers so that we have a way to return the alert rule trigger ids in the rule serializers. Backfill migration to follow.

@ceorourke ceorourke requested review from a team as code owners April 3, 2025 20:11
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 3, 2025
Copy link
Contributor

github-actions bot commented Apr 3, 2025

This PR has a migration; here is the generated SQL for src/sentry/workflow_engine/migrations/0041_datacondition_alertruletrigger_lookup_table.py ()

--
-- Create model DataConditionAlertRuleTrigger
--
CREATE TABLE "workflow_engine_dataconditionalertruletrigger" ("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, "alert_rule_trigger_id" bigint NULL, "data_condition_id" bigint NOT NULL, CONSTRAINT "workflow_engine_uniq_datacondition_alertruletrigger" UNIQUE ("alert_rule_trigger_id", "data_condition_id"));
ALTER TABLE "workflow_engine_dataconditionalertruletrigger" ADD CONSTRAINT "workflow_engine_data_data_condition_id_8a5d07b7_fk_workflow_" FOREIGN KEY ("data_condition_id") REFERENCES "workflow_engine_datacondition" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "workflow_engine_dataconditionalertruletrigger" VALIDATE CONSTRAINT "workflow_engine_data_data_condition_id_8a5d07b7_fk_workflow_";
CREATE INDEX CONCURRENTLY "workflow_engine_datacondit_data_condition_id_8a5d07b7" ON "workflow_engine_dataconditionalertruletrigger" ("data_condition_id");

Copy link

codecov bot commented Apr 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #88730      +/-   ##
==========================================
- Coverage   87.74%   87.73%   -0.01%     
==========================================
  Files       10055    10060       +5     
  Lines      568700   569080     +380     
  Branches    22321    22321              
==========================================
+ Hits       498981   499269     +288     
- Misses      69340    69432      +92     
  Partials      379      379              

Copy link
Member

@wedamija wedamija left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

migration lgtm

@ceorourke ceorourke merged commit 1dc6a1a into master Apr 3, 2025
48 checks passed
@ceorourke ceorourke deleted the ceorourke/ACI-237 branch April 3, 2025 22:22
andrewshie-sentry pushed a commit that referenced this pull request Apr 8, 2025
…rs (#88730)

Create a lookup table for "detector trigger" data conditions and alert
rule triggers so that we have a way to return the alert rule trigger ids
in the rule serializers. Backfill migration to follow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants