-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
src/sentry/workflow_engine/migrations/0066_workflow_action_group_status_table.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Generated by Django 5.2.1 on 2025-05-21 20:30 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
import sentry.db.models.fields.bounded | ||
import sentry.db.models.fields.foreignkey | ||
from sentry.new_migrations.migrations import CheckedMigration | ||
|
||
|
||
class Migration(CheckedMigration): | ||
# This flag is used to mark that a migration shouldn't be automatically run in production. | ||
# This should only be used for operations where it's safe to run the migration after your | ||
# code has deployed. So this should not be used for most operations that alter the schema | ||
# of a table. | ||
# Here are some things that make sense to mark as post deployment: | ||
# - Large data migrations. Typically we want these to be run manually so that they can be | ||
# monitored and not block the deploy for a long period of time while they run. | ||
# - Adding indexes to large tables. Since this can take a long time, we'd generally prefer to | ||
# run this outside deployments so that we don't block them. Note that while adding an index | ||
# is a schema change, it's completely safe to run the operation after the code has deployed. | ||
# Once deployed, run these manually via: https://develop.sentry.dev/database-migrations/#migration-deployment | ||
|
||
is_post_deployment = False | ||
|
||
dependencies = [ | ||
("sentry", "0905_fix_workflow_engine_cycle"), | ||
("workflow_engine", "0001_squashed_0065_add_status_to_detector_and_workflow"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="WorkflowActionGroupStatus", | ||
fields=[ | ||
( | ||
"id", | ||
sentry.db.models.fields.bounded.BoundedBigAutoField( | ||
primary_key=True, serialize=False | ||
), | ||
), | ||
("date_updated", models.DateTimeField(auto_now=True)), | ||
("date_added", models.DateTimeField(auto_now_add=True)), | ||
( | ||
"action", | ||
sentry.db.models.fields.foreignkey.FlexibleForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, to="workflow_engine.action" | ||
), | ||
), | ||
( | ||
"group", | ||
sentry.db.models.fields.foreignkey.FlexibleForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, to="sentry.group" | ||
), | ||
), | ||
( | ||
"workflow", | ||
sentry.db.models.fields.foreignkey.FlexibleForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, to="workflow_engine.workflow" | ||
), | ||
), | ||
], | ||
options={ | ||
"constraints": [ | ||
models.UniqueConstraint( | ||
fields=("workflow", "action", "group"), | ||
name="workflow_engine_uniq_workflow_action_group", | ||
) | ||
], | ||
}, | ||
), | ||
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/sentry/workflow_engine/models/workflow_action_group_status.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from django.db import models | ||
|
||
from sentry.backup.scopes import RelocationScope | ||
from sentry.db.models import DefaultFieldsModel, FlexibleForeignKey, region_silo_model | ||
|
||
|
||
@region_silo_model | ||
class WorkflowActionGroupStatus(DefaultFieldsModel): | ||
""" | ||
Stores when a workflow action last fired for a Group. | ||
""" | ||
|
||
__relocation_scope__ = RelocationScope.Excluded | ||
|
||
workflow = FlexibleForeignKey("workflow_engine.Workflow", on_delete=models.CASCADE) | ||
action = FlexibleForeignKey("workflow_engine.Action", on_delete=models.CASCADE) | ||
group = FlexibleForeignKey("sentry.Group") | ||
|
||
class Meta: | ||
constraints = [ | ||
models.UniqueConstraint( | ||
fields=["workflow", "action", "group"], | ||
name="workflow_engine_uniq_workflow_action_group", | ||
) | ||
] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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, thoughThere 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.
Yeah this is much too much data to relocate, we usually exclude things that are related to groups