Skip to content

Commit d865ebb

Browse files
committed
chore(aci): add flag to GET OrganizationAlertRuleIndexEndpoint
1 parent 16fe989 commit d865ebb

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/sentry/features/temporary.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,9 @@ def register_temporary_features(manager: FeatureManager) -> None:
463463
manager.add("organizations:workflow-engine-orgalertruledetails-get", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
464464
# Enable metric detector limits by plan type
465465
manager.add("organizations:workflow-engine-metric-detector-limit", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
466+
# Use workflow engine exclusively for OrganizationAlertRuleIndexEndpoint.get results.
467+
# See src/sentry/workflow_engine/docs/legacy_backport.md for context.
468+
manager.add("organizations:workflow-engine-orgalertruleindex-get", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
466469
# Enable EventUniqueUserFrequencyConditionWithConditions special alert condition
467470
manager.add("organizations:event-unique-user-frequency-condition-with-conditions", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
468471
# Enable our logs product (known internally as ourlogs) in UI and backend

src/sentry/incidents/endpoints/organization_alert_rule_index.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,10 @@ class AlertRuleFetchMixin(Endpoint):
235235
Can be used with any endpoint base class (OrganizationEndpoint, ProjectEndpoint, etc).
236236
"""
237237

238+
# Subclasses may set a per-method granular flag (e.g. for GET) that is OR'd
239+
# with the broad workflow-engine-rule-serializers flag.
240+
workflow_engine_method_flags: dict[str, str] = {}
241+
238242
def fetch_metric_alerts(
239243
self,
240244
request: Request,
@@ -252,8 +256,11 @@ def fetch_metric_alerts(
252256
extra={"organization": organization.id},
253257
)
254258

255-
use_workflow_engine = features.has(
256-
"organizations:workflow-engine-rule-serializers", organization
259+
method_flag = self.workflow_engine_method_flags.get(request.method or "")
260+
use_workflow_engine = (
261+
features.has("organizations:workflow-engine-rule-serializers", organization)
262+
or method_flag is not None
263+
and features.has(method_flag, organization)
257264
)
258265

259266
if use_workflow_engine:
@@ -908,6 +915,9 @@ class OrganizationAlertRuleIndexEndpoint(OrganizationAlertRuleBaseEndpoint, Aler
908915
"POST": ApiPublishStatus.PUBLIC,
909916
}
910917
permission_classes = (OrganizationAlertRulePermission,)
918+
workflow_engine_method_flags = {
919+
"GET": "organizations:workflow-engine-orgalertruleindex-get",
920+
}
911921

912922
@extend_schema(
913923
operation_id="(DEPRECATED) List an Organization's Metric Alert Rules",

0 commit comments

Comments
 (0)