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 milestone 3): ACI dual delete helper #82280

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

mifu67
Copy link
Contributor

@mifu67 mifu67 commented Dec 18, 2024

Add helper method to delete the corresponding rows in the ACI tables after deleting an AlertRule.

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Dec 18, 2024
@mifu67 mifu67 force-pushed the mifu67/aci/dual-delete-helpers branch from ca3704f to cd16d41 Compare December 18, 2024 00:42
Copy link

codecov bot commented Dec 18, 2024

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
23454 1 23453 252
View the top 1 failed tests by shortest run time
tests.sentry.workflow_engine.migration_helpers.test_migrate_alert_rule.AlertRuleMigrationHelpersTest::test_delete_metric_alert
Stack Traces | 2.39s run time
#x1B[1m#x1B[.../workflow_engine/migration_helpers/test_migrate_alert_rule.py#x1B[0m:96: in test_delete_metric_alert
    workflow_data_condition_group = WorkflowDataConditionGroup.objects.get(workflow=workflow)
#x1B[1m#x1B[31m.venv/lib/python3.12.../db/models/manager.py#x1B[0m:87: in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
#x1B[1m#x1B[31m.venv/lib/python3.12.../db/models/query.py#x1B[0m:649: in get
    raise self.model.DoesNotExist(
#x1B[1m#x1B[31mE   sentry.workflow_engine.models.workflow_data_condition_group.WorkflowDataConditionGroup.DoesNotExist: WorkflowDataConditionGroup matching query does not exist.#x1B[0m

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

src/sentry/incidents/logic.py Outdated Show resolved Hide resolved
Comment on lines +208 to +202
if data_source is None:
logger.error(
"DataSource does not exist",
extra={"alert_rule_id": AlertRule.id},
)
return
Copy link
Member

Choose a reason for hiding this comment

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

if the data source is deleted and we return early, is it possible we skip deleting the detectors or workflows?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I think it's possible. We're not deleting the data source anywhere outside of this dual delete function, though (for migrated legacy alert rules).

src/sentry/workflow_engine/migration_helpers/alert_rule.py Outdated Show resolved Hide resolved
src/sentry/workflow_engine/migration_helpers/alert_rule.py Outdated Show resolved Hide resolved
Copy link
Member

@ceorourke ceorourke left a comment

Choose a reason for hiding this comment

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

lgtm besides the little import, I think you said you wanted to wait until mine gets through to rebase though? if I'm mistaken lmk and I'll approve but don't wanna accidentally push it out too early

@@ -103,6 +103,8 @@
from sentry.utils.audit import create_audit_entry_from_user
from sentry.utils.snuba import is_measurement

# from sentry.workflow_engine.migration_helpers.alert_rule import dual_delete_migrated_alert_rule
Copy link
Member

Choose a reason for hiding this comment

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

oop

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.

3 participants