From eb945169008162d8fe6833732244e0f29ab33d54 Mon Sep 17 00:00:00 2001 From: Kyle Consalus Date: Wed, 15 Apr 2026 12:38:38 -0700 Subject: [PATCH] fix(aci): Improve legacy model tracking --- src/sentry/incidents/endpoints/bases.py | 3 +++ .../rules/history/endpoints/project_rule_group_history.py | 2 ++ src/sentry/rules/history/endpoints/project_rule_stats.py | 2 ++ 3 files changed, 7 insertions(+) diff --git a/src/sentry/incidents/endpoints/bases.py b/src/sentry/incidents/endpoints/bases.py index 5ce0ba86cf8bac..60db98c7da54fd 100644 --- a/src/sentry/incidents/endpoints/bases.py +++ b/src/sentry/incidents/endpoints/bases.py @@ -14,6 +14,7 @@ from sentry.workflow_engine.endpoints.utils.ids import to_valid_int_id from sentry.workflow_engine.models.alertrule_detector import AlertRuleDetector from sentry.workflow_engine.models.detector import Detector +from sentry.workflow_engine.utils.legacy_metric_tracking import report_used_legacy_models class OrganizationAlertRuleBaseEndpoint(OrganizationEndpoint): @@ -150,6 +151,7 @@ def convert_args( return args, kwargs + report_used_legacy_models() try: kwargs["alert_rule"] = AlertRule.objects.get( projects=project, id=validated_alert_rule_id @@ -203,6 +205,7 @@ def convert_args( return args, kwargs + report_used_legacy_models() try: kwargs["alert_rule"] = AlertRule.objects.get( organization=organization, id=validated_alert_rule_id diff --git a/src/sentry/rules/history/endpoints/project_rule_group_history.py b/src/sentry/rules/history/endpoints/project_rule_group_history.py index a40b271575b0e2..b7f6a8c10a74f2 100644 --- a/src/sentry/rules/history/endpoints/project_rule_group_history.py +++ b/src/sentry/rules/history/endpoints/project_rule_group_history.py @@ -23,6 +23,7 @@ from sentry.rules.history import fetch_rule_groups_paginated from sentry.rules.history.base import RuleGroupHistory from sentry.workflow_engine.models.workflow import Workflow +from sentry.workflow_engine.utils.legacy_metric_tracking import track_alert_endpoint_execution class RuleGroupHistoryResponse(TypedDict): @@ -78,6 +79,7 @@ class ProjectRuleGroupHistoryIndexEndpoint(WorkflowEngineRuleEndpoint): 404: RESPONSE_NOT_FOUND, }, ) + @track_alert_endpoint_execution("GET", "sentry-api-0-project-rule-group-history-index") def get(self, request: Request, project: Project, rule: Rule | Workflow) -> Response: per_page = self.get_per_page(request) cursor = self.get_cursor_from_request(request) diff --git a/src/sentry/rules/history/endpoints/project_rule_stats.py b/src/sentry/rules/history/endpoints/project_rule_stats.py index 9fc28a081e3ecb..1c17694a62d39d 100644 --- a/src/sentry/rules/history/endpoints/project_rule_stats.py +++ b/src/sentry/rules/history/endpoints/project_rule_stats.py @@ -20,6 +20,7 @@ from sentry.rules.history import fetch_rule_hourly_stats from sentry.rules.history.base import TimeSeriesValue from sentry.workflow_engine.models.workflow import Workflow +from sentry.workflow_engine.utils.legacy_metric_tracking import track_alert_endpoint_execution class TimeSeriesValueResponse(TypedDict): @@ -61,6 +62,7 @@ class ProjectRuleStatsIndexEndpoint(WorkflowEngineRuleEndpoint): 404: RESPONSE_NOT_FOUND, }, ) + @track_alert_endpoint_execution("GET", "sentry-api-0-project-rule-stats-index") def get(self, request: Request, project: Project, rule: Rule | Workflow) -> Response: """ Note that results are returned in hourly buckets.