Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/sentry/features/temporary.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,9 @@ def register_temporary_features(manager: FeatureManager) -> None:
# Use workflow engine exclusively for OrganizationCombinedRuleIndexEndpoint.get results.
# See src/sentry/workflow_engine/docs/legacy_backport.md for context.
manager.add("organizations:workflow-engine-combinedruleindex-get", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
# Use workflow engine exclusively for ProjectRuleGroupHistoryIndexEndpoint.get and ProjectRuleStatsIndexEndpoint.get results.
# See src/sentry/workflow_engine/docs/legacy_backport.md for context.
manager.add("organizations:workflow-engine-projectrulegroupstats-get", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
# Enable metric detector limits by plan type
manager.add("organizations:workflow-engine-metric-detector-limit", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
# Enable EventUniqueUserFrequencyConditionWithConditions special alert condition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ def serialize(
@extend_schema(tags=["issue_alerts"])
@cell_silo_endpoint
class ProjectRuleGroupHistoryIndexEndpoint(WorkflowEngineRuleEndpoint):
workflow_engine_method_flags = {
"GET": "organizations:workflow-engine-projectrulegroupstats-get",
}
publish_status = {
"GET": ApiPublishStatus.EXPERIMENTAL,
}
Expand Down
3 changes: 3 additions & 0 deletions src/sentry/rules/history/endpoints/project_rule_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ def serialize(
@extend_schema(tags=["issue_alerts"])
@cell_silo_endpoint
class ProjectRuleStatsIndexEndpoint(WorkflowEngineRuleEndpoint):
workflow_engine_method_flags = {
"GET": "organizations:workflow-engine-projectrulegroupstats-get",
}
publish_status = {
"GET": ApiPublishStatus.EXPERIMENTAL,
}
Expand Down
4 changes: 4 additions & 0 deletions tests/sentry/rules/history/backends/test_postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ def test_event_id(self) -> None:
)

@with_feature("organizations:workflow-engine-rule-serializers")
@with_feature("organizations:workflow-engine-projectrulegroupstats-get")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We don't really need both flags, I wonder if it implies we do that we use them. As is, this isn't specifically testing either. I'd say our preferred pattern here is probably use the big flag by default, but have a test that ensures that the targeted flag works.

Not blocking, just thinking. we can do a pass.

def test_single_written_workflow_history(self) -> None:
"""Test using WorkflowFireHistory when feature flag is enabled"""
workflow_triggers = self.create_data_condition_group()
Expand Down Expand Up @@ -276,6 +277,7 @@ def test_single_written_workflow_history(self) -> None:
)

@with_feature("organizations:workflow-engine-rule-serializers")
@with_feature("organizations:workflow-engine-projectrulegroupstats-get")
def test_combined_rule_and_workflow_history(self) -> None:
"""Test combining RuleFireHistory and WorkflowFireHistory when both exist"""
rule = self.create_project_rule(project=self.event.project)
Expand Down Expand Up @@ -416,6 +418,7 @@ def test(self) -> None:
assert [r.count for r in results[-5:]] == [0, 0, 1, 1, 0]

@with_feature("organizations:workflow-engine-rule-serializers")
@with_feature("organizations:workflow-engine-projectrulegroupstats-get")
def test_single_written_workflow_history(self) -> None:
"""Test using WorkflowFireHistory when feature flag is enabled"""
workflow_triggers = self.create_data_condition_group()
Expand Down Expand Up @@ -452,6 +455,7 @@ def test_single_written_workflow_history(self) -> None:
assert [r.count for r in results[-5:]] == [0, 2, 0, 1, 0]

@with_feature("organizations:workflow-engine-rule-serializers")
@with_feature("organizations:workflow-engine-projectrulegroupstats-get")
def test_combined_rule_and_workflow_history(self) -> None:
"""Test combining RuleFireHistory and WorkflowFireHistory when both exist"""
rule = self.create_project_rule(project=self.event.project)
Expand Down
Loading