Skip to content

Commit 82c2f93

Browse files
malwilleygeorge-sentry
authored andcommitted
ref(metric-issues): Remove workflow-engine-metric-issue-ui flag usage (#112433)
1 parent 24d1799 commit 82c2f93

File tree

6 files changed

+18
-98
lines changed

6 files changed

+18
-98
lines changed

src/sentry/features/temporary.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,6 @@ def register_temporary_features(manager: FeatureManager) -> None:
443443
manager.add("organizations:workflow-engine-action-filters-cache", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
444444
# Enable ingestion through trusted relays only
445445
manager.add("organizations:ingest-through-trusted-relays-only", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
446-
# Enable metric issue UI for issue alerts
447-
manager.add("organizations:workflow-engine-metric-issue-ui", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
448446
# Disable issue stream detector notifications for metric issues
449447
manager.add("organizations:workflow-engine-metric-issue-disable-issue-detector-notifications", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
450448
# Enable new workflow_engine UI (see: alerts create issues)

src/sentry/incidents/grouptype.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ class MetricIssue(GroupType):
350350
category_v2 = GroupCategory.METRIC.value
351351
creation_quota = Quota(3600, 60, 100)
352352
default_priority = PriorityLevel.HIGH
353+
released = True
353354
enable_auto_resolve = False
354355
enable_escalation_detection = False
355356
enable_status_change_workflow_notifications = False
@@ -375,18 +376,3 @@ class MetricIssue(GroupType):
375376
},
376377
},
377378
)
378-
379-
@classmethod
380-
def allow_ingest(cls, organization: Organization) -> bool:
381-
return True
382-
383-
@classmethod
384-
def allow_post_process_group(cls, organization: Organization) -> bool:
385-
return True
386-
387-
@classmethod
388-
def build_visible_feature_name(cls) -> list[str]:
389-
return [
390-
"organizations:workflow-engine-ui",
391-
"organizations:workflow-engine-metric-issue-ui",
392-
]

src/sentry/workflow_engine/processors/detector.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,31 +67,25 @@ def detectors(self) -> set[Detector]:
6767
def _is_issue_stream_detector_enabled(event_data: WorkflowEventData) -> bool:
6868
"""
6969
Check if the issue stream detector should be enabled for this event's group type.
70-
71-
Most group types enable the issue stream detector by default. MetricIssue is excluded
72-
unless the workflow-engine-metric-issue-ui feature flag is enabled for the organization,
73-
which allows incremental rollout of issue alerts for metric issues.
7470
"""
7571
group_type_id = event_data.group.type
7672
disabled_type_ids = options.get("workflow_engine.group.type_id.disable_issue_stream_detector")
7773
if group_type_id not in disabled_type_ids:
7874
return True
7975

76+
# Metric isssues are a special case currently.
77+
# In order to give users time to adjust to the new behavior, we allow them to disable the
78+
# issue stream detector for metric issues via a feature flag.
8079
if group_type_id != MetricIssue.type_id:
8180
return False
8281

8382
organization = event_data.event.project.organization
8483

85-
has_metric_issue_ui = features.has(
86-
"organizations:workflow-engine-metric-issue-ui", organization
87-
)
88-
# For most users, the issue stream detector for metric issues will be rolled out along with the metric issue UI.
89-
# For users who find that behavior undesirable, this feature flag will disable it for them.
9084
disable_issue_stream_detector_for_metric_issues = features.has(
9185
"organizations:workflow-engine-metric-issue-disable-issue-detector-notifications",
9286
organization,
9387
)
94-
return has_metric_issue_ui and not disable_issue_stream_detector_for_metric_issues
88+
return not disable_issue_stream_detector_for_metric_issues
9589

9690

9791
def get_detectors_for_event_data(

tests/sentry/workflow_engine/processors/test_detector.py

Lines changed: 11 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,6 @@ def setUp(self) -> None:
867867
self.group_event = GroupEvent.from_event(self.event, self.group)
868868

869869
def test_activity_update(self) -> None:
870-
# only picks up metric detector because the group type does not enable the issue stream detector
871870
activity = Activity.objects.create(
872871
project=self.project,
873872
group=self.group,
@@ -878,7 +877,7 @@ def test_activity_update(self) -> None:
878877
result = get_detectors_for_event_data(event_data, detector=self.detector)
879878
assert result is not None
880879
assert result.preferred_detector == self.detector
881-
assert result.detectors == {self.detector}
880+
assert result.detectors == {self.issue_stream_detector, self.detector}
882881

883882
def test_error_group_type(self) -> None:
884883
# default behavior for a group type is to pick up the issue stream detector
@@ -896,30 +895,6 @@ def test_metric_issue(self) -> None:
896895
result = get_detectors_for_event_data(event_data)
897896
assert result is not None
898897
assert result.preferred_detector == self.detector
899-
assert result.detectors == {self.detector}
900-
901-
def test_metric_issue_with_feature_flag(self) -> None:
902-
self.group_event.occurrence = self.occurrence
903-
904-
event_data = WorkflowEventData(event=self.group_event, group=self.group)
905-
with self.feature("organizations:workflow-engine-metric-issue-ui"):
906-
result = get_detectors_for_event_data(event_data)
907-
assert result is not None
908-
assert result.preferred_detector == self.detector
909-
assert result.detectors == {self.issue_stream_detector, self.detector}
910-
911-
def test_activity_update_with_feature_flag(self) -> None:
912-
activity = Activity.objects.create(
913-
project=self.project,
914-
group=self.group,
915-
type=ActivityType.SET_RESOLVED.value,
916-
user_id=self.user.id,
917-
)
918-
event_data = WorkflowEventData(event=activity, group=self.group)
919-
with self.feature("organizations:workflow-engine-metric-issue-ui"):
920-
result = get_detectors_for_event_data(event_data, detector=self.detector)
921-
assert result is not None
922-
assert result.preferred_detector == self.detector
923898
assert result.detectors == {self.issue_stream_detector, self.detector}
924899

925900
def test_metric_issue_with_disable_detector_flag(self) -> None:
@@ -928,18 +903,15 @@ def test_metric_issue_with_disable_detector_flag(self) -> None:
928903

929904
event_data = WorkflowEventData(event=self.group_event, group=self.group)
930905
with self.feature(
931-
{
932-
"organizations:workflow-engine-metric-issue-ui": True,
933-
"organizations:workflow-engine-metric-issue-disable-issue-detector-notifications": True,
934-
}
906+
"organizations:workflow-engine-metric-issue-disable-issue-detector-notifications"
935907
):
936908
result = get_detectors_for_event_data(event_data)
937909
assert result is not None
938910
assert result.preferred_detector == self.detector
939911
assert result.detectors == {self.detector}
940912

941-
def test_non_metric_issue_in_disable_list_with_feature_flag(self) -> None:
942-
"""Feature flag override only applies to MetricIssue, not other disabled group types."""
913+
def test_non_metric_issue_in_disable_list(self) -> None:
914+
"""Disable override only applies to MetricIssue, not other disabled group types."""
943915
self.group.update(type=FeedbackGroup.type_id)
944916
activity = Activity.objects.create(
945917
project=self.project,
@@ -948,16 +920,13 @@ def test_non_metric_issue_in_disable_list_with_feature_flag(self) -> None:
948920
user_id=self.user.id,
949921
)
950922
event_data = WorkflowEventData(event=activity, group=self.group)
951-
with (
952-
self.feature("organizations:workflow-engine-metric-issue-ui"),
953-
self.options(
954-
{
955-
"workflow_engine.group.type_id.disable_issue_stream_detector": [
956-
MetricIssue.type_id,
957-
FeedbackGroup.type_id,
958-
]
959-
}
960-
),
923+
with self.options(
924+
{
925+
"workflow_engine.group.type_id.disable_issue_stream_detector": [
926+
MetricIssue.type_id,
927+
FeedbackGroup.type_id,
928+
]
929+
}
961930
):
962931
result = get_detectors_for_event_data(event_data)
963932
assert result is None

tests/sentry/workflow_engine/processors/test_workflow.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ def test_regressed_event(self) -> None:
327327
@patch("sentry.workflow_engine.processors.detector.logger")
328328
def test_no_detector(self, mock_logger: MagicMock, mock_incr: MagicMock) -> None:
329329
self.group_event.occurrence = self.build_occurrence(evidence_data={})
330+
self.issue_stream_detector.delete()
330331

331332
result = process_workflows(self.batch_client, self.event_data, FROZEN_TIME)
332333
assert result.msg == "No Detectors associated with the issue were found"
@@ -446,13 +447,8 @@ def test_uses_issue_stream_workflows(self) -> None:
446447
assert len(result.data.triggered_actions) == 0
447448

448449
def test_multiple_detectors__preferred(self) -> None:
449-
_, issue_stream_detector, _, _ = self.create_detector_and_workflow(
450-
name_prefix="issue_stream",
451-
workflow_triggers=self.create_data_condition_group(),
452-
detector_type=IssueStreamGroupType.slug,
453-
)
454450
self.create_detector_workflow(
455-
detector=issue_stream_detector,
451+
detector=self.issue_stream_detector,
456452
workflow=self.error_workflow,
457453
)
458454

tests/snuba/search/test_backend.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
from sentry.exceptions import InvalidSearchQuery
1010
from sentry.grouping.grouptype import ErrorGroupType
11-
from sentry.incidents.grouptype import MetricIssue
1211
from sentry.issues.grouptype import (
1312
FeedbackGroup,
1413
NoiseConfig,
@@ -3489,28 +3488,6 @@ def setUp(self) -> None:
34893488
)
34903489
self.error_group_2 = error_event_2.group
34913490

3492-
def test_no_feature(self) -> None:
3493-
event_id = uuid.uuid4().hex
3494-
3495-
with self.feature(MetricIssue.build_ingest_feature_name()):
3496-
_, group_info = self.process_occurrence(
3497-
event_id=event_id,
3498-
project_id=self.project.id,
3499-
type=MetricIssue.type_id,
3500-
fingerprint=["some perf issue"],
3501-
event_data={
3502-
"title": "some problem",
3503-
"platform": "python",
3504-
"tags": {"my_tag": "1"},
3505-
"timestamp": before_now(minutes=1).isoformat(),
3506-
"received": before_now(minutes=1).isoformat(),
3507-
},
3508-
)
3509-
assert group_info is not None
3510-
3511-
results = self.make_query(search_filter_query="issue.category:metric_alert my_tag:1")
3512-
assert list(results) == []
3513-
35143491
def test_generic_query(self) -> None:
35153492
results = self.make_query(search_filter_query="issue.category:performance my_tag:1")
35163493
assert list(results) == [self.profile_group_1, self.profile_group_2]

0 commit comments

Comments
 (0)