Browse Source

chore(stats-detectors): Remove experimental regression issue (#64969)

This was the experimental regression issue code that can now be removed.
Tony Xiao 1 year ago
parent
commit
0db2753e81

+ 3 - 11
src/sentry/statistical_detectors/issue_platform_adapter.py

@@ -2,11 +2,7 @@ import hashlib
 import uuid
 from datetime import datetime, timezone
 
-from sentry.issues.grouptype import (
-    GroupType,
-    PerformanceDurationRegressionGroupType,
-    PerformanceP95EndpointRegressionGroupType,
-)
+from sentry.issues.grouptype import GroupType, PerformanceP95EndpointRegressionGroupType
 from sentry.issues.issue_occurrence import IssueEvidence, IssueOccurrence
 from sentry.issues.producer import PayloadType, produce_occurrence_to_kafka
 from sentry.seer.utils import BreakpointData
@@ -21,7 +17,7 @@ def fingerprint_regression(transaction, full=False):
     return fingerprint
 
 
-def send_regression_to_platform(regression: BreakpointData, released: bool):
+def send_regression_to_platform(regression: BreakpointData):
     current_timestamp = datetime.utcnow().replace(tzinfo=timezone.utc)
 
     displayed_old_baseline = round(float(regression["aggregate_range_1"]), 2)
@@ -31,11 +27,7 @@ def send_regression_to_platform(regression: BreakpointData, released: bool):
     # TODO fix this in the breakpoint microservice and in trends v2
     project_id = int(regression["project"])
 
-    issue_type: type[GroupType] = (
-        PerformanceP95EndpointRegressionGroupType
-        if released
-        else PerformanceDurationRegressionGroupType
-    )
+    issue_type: type[GroupType] = PerformanceP95EndpointRegressionGroupType
 
     occurrence = IssueOccurrence(
         id=uuid.uuid4().hex,

+ 1 - 2
src/sentry/tasks/statistical_detectors.py

@@ -387,7 +387,7 @@ def _detect_transaction_change_points(
 
     for regression in regressions:
         breakpoint_count += 1
-        send_regression_to_platform(regression, True)
+        send_regression_to_platform(regression)
 
     metrics.incr(
         "statistical_detectors.breakpoint.emitted",
@@ -565,7 +565,6 @@ def emit_function_regression_issue(
                 "trend_percentage": regression["trend_percentage"],
                 "unweighted_p_value": regression["unweighted_p_value"],
                 "unweighted_t_value": regression["unweighted_t_value"],
-                "released": True,
             }
         )
 

+ 4 - 18
tests/sentry/statistical_detectors/test_issue_platform_adapter.py

@@ -1,27 +1,13 @@
 from unittest import mock
 
-import pytest
-
-from sentry.issues.grouptype import (
-    PerformanceDurationRegressionGroupType,
-    PerformanceP95EndpointRegressionGroupType,
-)
+from sentry.issues.grouptype import PerformanceP95EndpointRegressionGroupType
 from sentry.seer.utils import BreakpointData
 from sentry.statistical_detectors.issue_platform_adapter import send_regression_to_platform
 
 
-@pytest.mark.parametrize(
-    ["released", "issue_type"],
-    [
-        pytest.param(False, PerformanceDurationRegressionGroupType, id="unreleased"),
-        pytest.param(True, PerformanceP95EndpointRegressionGroupType, id="released"),
-    ],
-)
 @mock.patch("sentry.statistical_detectors.issue_platform_adapter.produce_occurrence_to_kafka")
 def test_send_regressions_to_plaform(
     mock_produce_occurrence_to_kafka,
-    released,
-    issue_type,
 ):
     project_id = "123"
 
@@ -38,7 +24,7 @@ def test_send_regressions_to_plaform(
         "breakpoint": 1691366400,
     }
 
-    send_regression_to_platform(mock_regression, released)
+    send_regression_to_platform(mock_regression)
 
     assert len(mock_produce_occurrence_to_kafka.mock_calls) == 1
 
@@ -51,7 +37,7 @@ def test_send_regressions_to_plaform(
         occurrence,
         **{
             "project_id": 123,
-            "issue_title": issue_type.description,
+            "issue_title": PerformanceP95EndpointRegressionGroupType.description,
             "subtitle": "Increased from 14.0ms to 28.0ms (P95)",
             "resource_id": None,
             "evidence_data": mock_regression,
@@ -63,7 +49,7 @@ def test_send_regressions_to_plaform(
                 },
                 {"name": "Transaction", "value": "foo", "important": True},
             ],
-            "type": issue_type.type_id,
+            "type": PerformanceP95EndpointRegressionGroupType.type_id,
             "level": "info",
             "culprit": "foo",
         },

+ 2 - 2
tests/sentry/tasks/test_auto_resolve_issues.py

@@ -5,7 +5,7 @@ from unittest.mock import patch
 from django.utils import timezone
 
 from sentry.issues.grouptype import (
-    PerformanceDurationRegressionGroupType,
+    PerformanceP95EndpointRegressionGroupType,
     PerformanceSlowDBQueryGroupType,
 )
 from sentry.models.group import Group, GroupStatus
@@ -122,7 +122,7 @@ class ScheduleAutoResolutionTest(TestCase):
             project=project,
             status=GroupStatus.UNRESOLVED,
             last_seen=timezone.now() - timedelta(days=1),
-            type=PerformanceDurationRegressionGroupType.type_id,  # Test that auto_resolve is disabled for SD
+            type=PerformanceP95EndpointRegressionGroupType.type_id,  # Test that auto_resolve is disabled for SD
         )
 
         mock_backend.get_size.return_value = 0

+ 3 - 3
tests/sentry/tasks/test_post_process.py

@@ -24,8 +24,8 @@ from sentry.integrations.mixins.commit_context import CommitInfo, FileBlameInfo
 from sentry.issues.grouptype import (
     FeedbackGroup,
     GroupCategory,
-    PerformanceDurationRegressionGroupType,
     PerformanceNPlusOneGroupType,
+    PerformanceP95EndpointRegressionGroupType,
     ProfileFileIOGroupType,
 )
 from sentry.issues.ingest import save_issue_occurrence
@@ -2486,7 +2486,7 @@ class PostProcessGroupAggregateEventTest(
 ):
     def create_event(self, data, project_id):
         group = self.create_group(
-            type=PerformanceDurationRegressionGroupType.type_id,
+            type=PerformanceP95EndpointRegressionGroupType.type_id,
         )
 
         event = self.store_event(data=data, project_id=project_id)
@@ -2513,7 +2513,7 @@ class PostProcessGroupAggregateEventTest(
         if cache_key is None:
             cache_key = write_event_to_cache(event)
         with self.feature(
-            PerformanceDurationRegressionGroupType.build_post_process_group_feature_name()
+            PerformanceP95EndpointRegressionGroupType.build_post_process_group_feature_name()
         ):
             post_process_group(
                 is_new=is_new,

+ 5 - 5
tests/sentry/tasks/test_weekly_escalating_forecast.py

@@ -2,7 +2,7 @@ from datetime import datetime, timezone
 from unittest.mock import MagicMock, patch
 
 from sentry.issues.escalating_group_forecast import ONE_EVENT_FORECAST, EscalatingGroupForecast
-from sentry.issues.grouptype import ErrorGroupType, PerformanceDurationRegressionGroupType
+from sentry.issues.grouptype import ErrorGroupType, PerformanceP95EndpointRegressionGroupType
 from sentry.models.group import Group, GroupStatus
 from sentry.tasks.weekly_escalating_forecast import run_escalating_forecast
 from sentry.testutils.cases import APITestCase, SnubaTestCase
@@ -58,7 +58,7 @@ class TestWeeklyEscalatingForecast(APITestCase, SnubaTestCase):
         """
         with self.tasks():
             group_list = self.create_archived_until_escalating_groups(
-                num_groups=1, group_type=PerformanceDurationRegressionGroupType.type_id
+                num_groups=1, group_type=PerformanceP95EndpointRegressionGroupType.type_id
             )
 
             mock_query_groups_past_counts.return_value = {}
@@ -107,7 +107,7 @@ class TestWeeklyEscalatingForecast(APITestCase, SnubaTestCase):
     ) -> None:
         with self.tasks():
             group_list = self.create_archived_until_escalating_groups(
-                num_groups=1, group_type=PerformanceDurationRegressionGroupType.type_id
+                num_groups=1, group_type=PerformanceP95EndpointRegressionGroupType.type_id
             )
 
             mock_query_groups_past_counts.return_value = get_mock_groups_past_counts_response(
@@ -162,7 +162,7 @@ class TestWeeklyEscalatingForecast(APITestCase, SnubaTestCase):
     ) -> None:
         with self.tasks():
             group_list = self.create_archived_until_escalating_groups(
-                num_groups=3, group_type=PerformanceDurationRegressionGroupType.type_id
+                num_groups=3, group_type=PerformanceP95EndpointRegressionGroupType.type_id
             )
 
             mock_query_groups_past_counts.return_value = get_mock_groups_past_counts_response(
@@ -216,7 +216,7 @@ class TestWeeklyEscalatingForecast(APITestCase, SnubaTestCase):
     ) -> None:
         with self.tasks():
             group_list = self.create_archived_until_escalating_groups(
-                num_groups=1, group_type=PerformanceDurationRegressionGroupType.type_id
+                num_groups=1, group_type=PerformanceP95EndpointRegressionGroupType.type_id
             )
 
             mock_query_groups_past_counts.return_value = get_mock_groups_past_counts_response(