Browse Source

Revert "feat(issue-priority): Add new `GroupType.default_priority` field (#64687)"

This reverts commit 8a39d3d8fd9a5229bd9b219144cbb638e17ad944.

Co-authored-by: asottile-sentry <103459774+asottile-sentry@users.noreply.github.com>
getsentry-bot 1 year ago
parent
commit
92e8248445

+ 2 - 1
src/sentry/event_manager.py

@@ -54,6 +54,7 @@ from sentry.grouping.ingest import (
 from sentry.ingest.inbound_filters import FilterStatKeys
 from sentry.issues.grouptype import GroupCategory
 from sentry.issues.issue_occurrence import IssueOccurrence
+from sentry.issues.priority import PriorityLevel
 from sentry.issues.producer import PayloadType, produce_occurrence_to_kafka
 from sentry.killswitches import killswitch_matches_context
 from sentry.lang.native.utils import STORE_CRASH_REPORTS_ALL, convert_crashreport_count
@@ -96,7 +97,7 @@ from sentry.tasks.process_buffer import buffer_incr
 from sentry.tasks.relay import schedule_invalidate_project_config
 from sentry.tsdb.base import TSDBModel
 from sentry.types.activity import ActivityType
-from sentry.types.group import GroupSubStatus, PriorityLevel
+from sentry.types.group import GroupSubStatus
 from sentry.usage_accountant import record
 from sentry.utils import json, metrics
 from sentry.utils.cache import cache_key_for_event

+ 2 - 33
src/sentry/issues/grouptype.py

@@ -11,7 +11,6 @@ import sentry_sdk
 from sentry import features
 from sentry.features.base import OrganizationFeature
 from sentry.ratelimits.sliding_windows import Quota
-from sentry.types.group import PriorityLevel
 from sentry.utils import metrics
 
 if TYPE_CHECKING:
@@ -117,7 +116,6 @@ class GroupType:
     description: str
     category: int
     noise_config: NoiseConfig | None = None
-    default_priority: int = PriorityLevel.MEDIUM
     # If True this group type should be released everywhere. If False, fall back to features to
     # decide if this is released.
     released: bool = False
@@ -219,7 +217,6 @@ class ErrorGroupType(GroupType):
     slug = "error"
     description = "Error"
     category = GroupCategory.ERROR.value
-    default_priority = PriorityLevel.MEDIUM
     released = True
 
 
@@ -235,7 +232,6 @@ class PerformanceSlowDBQueryGroupType(PerformanceGroupTypeDefaults, GroupType):
     description = "Slow DB Query"
     category = GroupCategory.PERFORMANCE.value
     noise_config = NoiseConfig(ignore_limit=100)
-    default_priority = PriorityLevel.LOW
     released = True
 
 
@@ -245,7 +241,6 @@ class PerformanceRenderBlockingAssetSpanGroupType(PerformanceGroupTypeDefaults,
     slug = "performance_render_blocking_asset_span"
     description = "Large Render Blocking Asset"
     category = GroupCategory.PERFORMANCE.value
-    default_priority = PriorityLevel.LOW
     released = True
 
 
@@ -255,7 +250,6 @@ class PerformanceNPlusOneGroupType(PerformanceGroupTypeDefaults, GroupType):
     slug = "performance_n_plus_one_db_queries"
     description = "N+1 Query"
     category = GroupCategory.PERFORMANCE.value
-    default_priority = PriorityLevel.LOW
     released = True
 
 
@@ -266,7 +260,6 @@ class PerformanceConsecutiveDBQueriesGroupType(PerformanceGroupTypeDefaults, Gro
     description = "Consecutive DB Queries"
     category = GroupCategory.PERFORMANCE.value
     noise_config = NoiseConfig(ignore_limit=15)
-    default_priority = PriorityLevel.LOW
     released = True
 
 
@@ -276,7 +269,6 @@ class PerformanceFileIOMainThreadGroupType(PerformanceGroupTypeDefaults, GroupTy
     slug = "performance_file_io_main_thread"
     description = "File IO on Main Thread"
     category = GroupCategory.PERFORMANCE.value
-    default_priority = PriorityLevel.LOW
     released = True
 
 
@@ -287,7 +279,6 @@ class PerformanceConsecutiveHTTPQueriesGroupType(PerformanceGroupTypeDefaults, G
     description = "Consecutive HTTP"
     category = GroupCategory.PERFORMANCE.value
     noise_config = NoiseConfig(ignore_limit=5)
-    default_priority = PriorityLevel.LOW
     released = True
 
 
@@ -297,7 +288,6 @@ class PerformanceNPlusOneAPICallsGroupType(GroupType):
     slug = "performance_n_plus_one_api_calls"
     description = "N+1 API Call"
     category = GroupCategory.PERFORMANCE.value
-    default_priority = PriorityLevel.LOW
     released = True
 
 
@@ -307,7 +297,6 @@ class PerformanceMNPlusOneDBQueriesGroupType(PerformanceGroupTypeDefaults, Group
     slug = "performance_m_n_plus_one_db_queries"
     description = "MN+1 Query"
     category = GroupCategory.PERFORMANCE.value
-    default_priority = PriorityLevel.LOW
     released = True
 
 
@@ -318,7 +307,6 @@ class PerformanceUncompressedAssetsGroupType(PerformanceGroupTypeDefaults, Group
     description = "Uncompressed Asset"
     category = GroupCategory.PERFORMANCE.value
     noise_config = NoiseConfig(ignore_limit=100)
-    default_priority = PriorityLevel.LOW
     released = True
 
 
@@ -328,7 +316,6 @@ class PerformanceDBMainThreadGroupType(PerformanceGroupTypeDefaults, GroupType):
     slug = "performance_db_main_thread"
     description = "DB on Main Thread"
     category = GroupCategory.PERFORMANCE.value
-    default_priority = PriorityLevel.LOW
     released = True
 
 
@@ -338,7 +325,6 @@ class PerformanceLargeHTTPPayloadGroupType(PerformanceGroupTypeDefaults, GroupTy
     slug = "performance_large_http_payload"
     description = "Large HTTP payload"
     category = GroupCategory.PERFORMANCE.value
-    default_priority = PriorityLevel.LOW
     released = True
 
 
@@ -349,7 +335,6 @@ class PerformanceHTTPOverheadGroupType(PerformanceGroupTypeDefaults, GroupType):
     description = "HTTP/1.1 Overhead"
     noise_config = NoiseConfig(ignore_limit=20)
     category = GroupCategory.PERFORMANCE.value
-    default_priority = PriorityLevel.LOW
 
 
 # experimental
@@ -361,7 +346,6 @@ class PerformanceDurationRegressionGroupType(GroupType):
     category = GroupCategory.PERFORMANCE.value
     enable_auto_resolve = False
     enable_escalation_detection = False
-    default_priority = PriorityLevel.LOW
 
 
 @dataclass(frozen=True)
@@ -372,7 +356,6 @@ class PerformanceP95EndpointRegressionGroupType(GroupType):
     category = GroupCategory.PERFORMANCE.value
     enable_auto_resolve = False
     enable_escalation_detection = False
-    default_priority = PriorityLevel.MEDIUM
     released = True
 
 
@@ -383,7 +366,6 @@ class ProfileFileIOGroupType(GroupType):
     slug = "profile_file_io_main_thread"
     description = "File I/O on Main Thread"
     category = GroupCategory.PERFORMANCE.value
-    default_priority = PriorityLevel.LOW
 
 
 @dataclass(frozen=True)
@@ -392,7 +374,6 @@ class ProfileImageDecodeGroupType(GroupType):
     slug = "profile_image_decode_main_thread"
     description = "Image Decoding on Main Thread"
     category = GroupCategory.PERFORMANCE.value
-    default_priority = PriorityLevel.LOW
 
 
 @dataclass(frozen=True)
@@ -401,7 +382,6 @@ class ProfileJSONDecodeType(GroupType):
     slug = "profile_json_decode_main_thread"
     description = "JSON Decoding on Main Thread"
     category = GroupCategory.PERFORMANCE.value
-    default_priority = PriorityLevel.LOW
 
 
 @dataclass(frozen=True)
@@ -410,17 +390,17 @@ class ProfileCoreDataExperimentalType(GroupType):
     slug = "profile_core_data_main_exp"
     description = "Core Data on Main Thread"
     category = GroupCategory.PERFORMANCE.value
-    default_priority = PriorityLevel.LOW
 
 
 # 2005 was ProfileRegexExperimentalType
+
+
 @dataclass(frozen=True)
 class ProfileViewIsSlowExperimentalType(GroupType):
     type_id = 2006
     slug = "profile_view_is_slow_experimental"
     description = "View Render/Layout/Update is slow"
     category = GroupCategory.PERFORMANCE.value
-    default_priority = PriorityLevel.LOW
 
 
 @dataclass(frozen=True)
@@ -430,7 +410,6 @@ class ProfileRegexType(GroupType):
     description = "Regex on Main Thread"
     category = GroupCategory.PERFORMANCE.value
     released = True
-    default_priority = PriorityLevel.LOW
 
 
 @dataclass(frozen=True)
@@ -439,7 +418,6 @@ class ProfileFrameDropExperimentalType(GroupType):
     slug = "profile_frame_drop_experimental"
     description = "Frame Drop"
     category = GroupCategory.PERFORMANCE.value
-    default_priority = PriorityLevel.LOW
 
 
 @dataclass(frozen=True)
@@ -450,7 +428,6 @@ class ProfileFrameDropType(GroupType):
     category = GroupCategory.PERFORMANCE.value
     noise_config = NoiseConfig(ignore_limit=2000)
     released = True
-    default_priority = PriorityLevel.LOW
 
 
 @dataclass(frozen=True)
@@ -460,7 +437,6 @@ class ProfileFunctionRegressionExperimentalType(GroupType):
     description = "Function Duration Regression (Experimental)"
     category = GroupCategory.PERFORMANCE.value
     enable_auto_resolve = False
-    default_priority = PriorityLevel.LOW
 
 
 @dataclass(frozen=True)
@@ -471,7 +447,6 @@ class ProfileFunctionRegressionType(GroupType):
     category = GroupCategory.PERFORMANCE.value
     enable_auto_resolve = False
     released = True
-    default_priority = PriorityLevel.MEDIUM
 
 
 @dataclass(frozen=True)
@@ -482,7 +457,6 @@ class MonitorCheckInFailure(GroupType):
     category = GroupCategory.CRON.value
     released = True
     creation_quota = Quota(3600, 60, 60_000)  # 60,000 per hour, sliding window of 60 seconds
-    default_priority = PriorityLevel.HIGH
 
 
 @dataclass(frozen=True)
@@ -493,7 +467,6 @@ class MonitorCheckInTimeout(GroupType):
     category = GroupCategory.CRON.value
     released = True
     creation_quota = Quota(3600, 60, 60_000)  # 60,000 per hour, sliding window of 60 seconds
-    default_priority = PriorityLevel.HIGH
 
 
 @dataclass(frozen=True)
@@ -504,7 +477,6 @@ class MonitorCheckInMissed(GroupType):
     category = GroupCategory.CRON.value
     released = True
     creation_quota = Quota(3600, 60, 60_000)  # 60,000 per hour, sliding window of 60 seconds
-    default_priority = PriorityLevel.HIGH
 
 
 @dataclass(frozen=True)
@@ -514,7 +486,6 @@ class ReplayDeadClickType(GroupType):
     slug = "replay_click_dead"
     description = "Dead Click Detected"
     category = GroupCategory.REPLAY.value
-    default_priority = PriorityLevel.MEDIUM
 
 
 @dataclass(frozen=True)
@@ -523,7 +494,6 @@ class ReplayRageClickType(GroupType):
     slug = "replay_click_rage"
     description = "Rage Click Detected"
     category = GroupCategory.REPLAY.value
-    default_priority = PriorityLevel.MEDIUM
 
 
 @dataclass(frozen=True)
@@ -533,7 +503,6 @@ class FeedbackGroup(GroupType):
     description = "Feedback"
     category = GroupCategory.FEEDBACK.value
     creation_quota = Quota(3600, 60, 1000)  # 1000 per hour, sliding window of 60 seconds
-    default_priority = PriorityLevel.MEDIUM
 
 
 @metrics.wraps("noise_reduction.should_create_group", sample_rate=1.0)

+ 7 - 2
src/sentry/issues/priority.py

@@ -1,7 +1,7 @@
 from __future__ import annotations
 
 import logging
-from enum import Enum
+from enum import Enum, IntEnum
 from typing import TYPE_CHECKING
 
 from sentry import features
@@ -10,12 +10,17 @@ from sentry.models.grouphistory import GroupHistory, GroupHistoryStatus, record_
 from sentry.models.user import User
 from sentry.services.hybrid_cloud.user.model import RpcUser
 from sentry.types.activity import ActivityType
-from sentry.types.group import PriorityLevel
 
 if TYPE_CHECKING:
     from sentry.models.group import Group
 
 
+class PriorityLevel(IntEnum):
+    LOW = 25
+    MEDIUM = 50
+    HIGH = 75
+
+
 PRIORITY_LEVEL_TO_STR: dict[int, str] = {
     PriorityLevel.LOW: "low",
     PriorityLevel.MEDIUM: "medium",

+ 0 - 7
src/sentry/types/group.py

@@ -1,5 +1,4 @@
 from collections.abc import Mapping
-from enum import IntEnum
 
 
 class GroupSubStatus:
@@ -66,9 +65,3 @@ GROUP_SUBSTATUS_TO_GROUP_HISTORY_STATUS = {
     GroupSubStatus.FOREVER: "archived_forever",
     GroupSubStatus.UNTIL_CONDITION_MET: "archived_until_condition_met",
 }
-
-
-class PriorityLevel(IntEnum):
-    LOW = 25
-    MEDIUM = 50
-    HIGH = 75

+ 1 - 1
tests/sentry/event_manager/test_priority.py

@@ -4,11 +4,11 @@ import logging
 from unittest.mock import MagicMock, patch
 
 from sentry.event_manager import EventManager
+from sentry.issues.priority import PriorityLevel
 from sentry.testutils.cases import TestCase
 from sentry.testutils.helpers.features import with_feature
 from sentry.testutils.silo import region_silo_test
 from sentry.testutils.skips import requires_snuba
-from sentry.types.group import PriorityLevel
 from tests.sentry.event_manager.test_severity import make_event
 
 pytestmark = [requires_snuba]

+ 1 - 1
tests/sentry/issues/test_priority.py

@@ -4,6 +4,7 @@ from sentry.issues.priority import (
     PRIORITY_LEVEL_TO_STR,
     PRIORITY_TO_GROUP_HISTORY_STATUS,
     PriorityChangeReason,
+    PriorityLevel,
     auto_update_priority,
 )
 from sentry.models.activity import Activity
@@ -13,7 +14,6 @@ from sentry.testutils.cases import TestCase
 from sentry.testutils.helpers.datetime import before_now
 from sentry.testutils.helpers.features import apply_feature_flag_on_cls
 from sentry.types.activity import ActivityType
-from sentry.types.group import PriorityLevel
 
 
 @apply_feature_flag_on_cls("projects:issue-priority")

+ 1 - 2
tests/sentry/models/test_activity.py

@@ -1,13 +1,12 @@
 import logging
 
 from sentry.event_manager import EventManager
-from sentry.issues.priority import PRIORITY_LEVEL_TO_STR
+from sentry.issues.priority import PRIORITY_LEVEL_TO_STR, PriorityLevel
 from sentry.models.activity import Activity
 from sentry.testutils.cases import TestCase
 from sentry.testutils.helpers.features import with_feature
 from sentry.testutils.silo import region_silo_test
 from sentry.types.activity import ActivityType
-from sentry.types.group import PriorityLevel
 from sentry.utils.iterators import chunked
 from tests.sentry.event_manager.test_event_manager import make_event
 

+ 2 - 1
tests/sentry/tasks/test_post_process.py

@@ -29,6 +29,7 @@ from sentry.issues.grouptype import (
     ProfileFileIOGroupType,
 )
 from sentry.issues.ingest import save_issue_occurrence
+from sentry.issues.priority import PriorityLevel
 from sentry.models.activity import Activity, ActivityIntegration
 from sentry.models.group import GROUP_SUBSTATUS_TO_STATUS_MAP, Group, GroupStatus
 from sentry.models.groupassignee import GroupAssignee
@@ -71,7 +72,7 @@ from sentry.testutils.performance_issues.store_transaction import PerfIssueTrans
 from sentry.testutils.silo import assume_test_silo_mode, region_silo_test
 from sentry.testutils.skips import requires_snuba
 from sentry.types.activity import ActivityType
-from sentry.types.group import GroupSubStatus, PriorityLevel
+from sentry.types.group import GroupSubStatus
 from sentry.utils import json
 from sentry.utils.cache import cache
 from sentry.utils.sdk_crashes.sdk_crash_detection_config import SdkName

+ 1 - 1
tests/snuba/api/endpoints/test_group_details.py

@@ -4,6 +4,7 @@ from rest_framework.exceptions import ErrorDetail
 
 from sentry import tsdb
 from sentry.issues.forecasts import generate_and_save_forecasts
+from sentry.issues.priority import PriorityLevel
 from sentry.models.activity import Activity
 from sentry.models.environment import Environment
 from sentry.models.group import GroupStatus
@@ -15,7 +16,6 @@ from sentry.testutils.helpers.datetime import before_now, iso_format
 from sentry.testutils.helpers.features import with_feature
 from sentry.testutils.silo import region_silo_test
 from sentry.types.activity import ActivityType
-from sentry.types.group import PriorityLevel
 
 
 @region_silo_test

+ 1 - 1
tests/snuba/api/serializers/test_group.py

@@ -7,6 +7,7 @@ from sentry.api.event_search import SearchFilter, SearchKey, SearchValue
 from sentry.api.serializers import serialize
 from sentry.api.serializers.models.group import GroupSerializerSnuba
 from sentry.issues.grouptype import PerformanceNPlusOneGroupType, ProfileFileIOGroupType
+from sentry.issues.priority import PriorityLevel
 from sentry.models.group import Group, GroupStatus
 from sentry.models.groupenvironment import GroupEnvironment
 from sentry.models.grouplink import GroupLink
@@ -22,7 +23,6 @@ from sentry.testutils.helpers.datetime import before_now, iso_format
 from sentry.testutils.helpers.features import with_feature
 from sentry.testutils.performance_issues.store_transaction import PerfIssueTransactionTestMixin
 from sentry.testutils.silo import assume_test_silo_mode, region_silo_test
-from sentry.types.group import PriorityLevel
 from sentry.utils.samples import load_data
 from tests.sentry.issues.test_utils import SearchIssueTestMixin