-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
fix(aci): Improve legacy model tracking #113110
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: The Suggested FixModify the Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews. |
||
| 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) | ||
|
|
||
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.
ContextVar reset in decorator nullifies convert_args tracking
High Severity
report_used_legacy_models()inconvert_argssets_legacy_models_usedtoTrue, butconvert_argsruns before the endpoint handler method. Thetrack_alert_endpoint_executiondecorator on the handler resets the ContextVar toFalseat the start of its wrapper. This means the legacy-model flag is always wiped before the decorator reads it, solegacy_modelswill always be reported asfalse— defeating the entire purpose of this tracking improvement. The same issue applies to the newly decorated rule history/stats endpoints, where the pre-existingreport_used_legacy_models()inWorkflowEngineRuleEndpoint.convert_argsis similarly reset.Additional Locations (2)
src/sentry/incidents/endpoints/bases.py#L207-L208src/sentry/rules/history/endpoints/project_rule_group_history.py#L81-L82Reviewed by Cursor Bugbot for commit eb94516. Configure here.