Skip to content

Commit 3e91f50

Browse files
authored
ref(issue-taxonomy): Add new category mapping to GroupType definitions (#90099)
Simple change that adds `category_v2` to the `GroupType` definition. This new property will decide how issues are categorized going forward, but this PR does not add any behavior changes. For now, this only adds the the category mappings. Followup PRs will check organization flags to determine which mapping to use.
1 parent 47109e4 commit 3e91f50

File tree

10 files changed

+102
-1
lines changed

10 files changed

+102
-1
lines changed

src/sentry/grouping/grouptype.py

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class ErrorGroupType(GroupType):
2626
slug = "error"
2727
description = "Error"
2828
category = GroupCategory.ERROR.value
29+
category_v2 = GroupCategory.ERROR.value
2930
default_priority = PriorityLevel.MEDIUM
3031
released = True
3132
detector_settings = DetectorSettings(

src/sentry/incidents/grouptype.py

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class MetricIssue(GroupType):
5656
slug = "metric_issue"
5757
description = "Metric issue triggered"
5858
category = GroupCategory.METRIC_ALERT.value
59+
category_v2 = GroupCategory.PERFORMANCE_REGRESSION.value
5960
creation_quota = Quota(3600, 60, 100)
6061
default_priority = PriorityLevel.HIGH
6162
enable_auto_resolve = False

src/sentry/issues/grouptype.py

+60
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,41 @@
2929

3030
class GroupCategory(IntEnum):
3131
ERROR = 1
32+
"""
33+
Deprecated
34+
Will be broken out into PERFORMANCE_REGRESSION, PERFORMANCE_BEST_PRACTICE, and RESPONSIVENESS
35+
"""
3236
PERFORMANCE = 2
3337
PROFILE = 3 # deprecated, merging with PERFORMANCE
38+
"""
39+
Deprecated
40+
Cron types will move to the OUTAGE category
41+
"""
3442
CRON = 4
43+
"""
44+
Deprecated
45+
Replay types will move to the USER_EXPERIENCE category
46+
"""
3547
REPLAY = 5
3648
FEEDBACK = 6
49+
"""
50+
Deprecated
51+
Uptime types will move to the OUTAGE category
52+
"""
3753
UPTIME = 7
54+
"""
55+
Deprecated
56+
Metric alert types will move to the PERFORMANCE_REGRESSION category
57+
"""
3858
METRIC_ALERT = 8
3959

60+
# New issue categories (under the organizations:issue-taxonomy flag)
61+
OUTAGE = 9
62+
PERFORMANCE_REGRESSION = 10
63+
USER_EXPERIENCE = 11
64+
RESPONSIVENESS = 12
65+
PERFORMANCE_BEST_PRACTICE = 13
66+
4067

4168
GROUP_CATEGORIES_CUSTOM_EMAIL = (
4269
GroupCategory.ERROR,
@@ -60,6 +87,7 @@ class GroupTypeRegistry:
6087
_registry: dict[int, type[GroupType]] = field(default_factory=dict)
6188
_slug_lookup: dict[str, type[GroupType]] = field(default_factory=dict)
6289
_category_lookup: dict[int, set[int]] = field(default_factory=lambda: defaultdict(set))
90+
_category_lookup_v2: dict[int, set[int]] = field(default_factory=lambda: defaultdict(set))
6391

6492
def add(self, group_type: type[GroupType]) -> None:
6593
if self._registry.get(group_type.type_id):
@@ -69,6 +97,7 @@ def add(self, group_type: type[GroupType]) -> None:
6997
self._registry[group_type.type_id] = group_type
7098
self._slug_lookup[group_type.slug] = group_type
7199
self._category_lookup[group_type.category].add(group_type.type_id)
100+
self._category_lookup_v2[group_type.category_v2].add(group_type.type_id)
72101

73102
def all(self) -> list[type[GroupType]]:
74103
return list(self._registry.values())
@@ -105,6 +134,9 @@ def get_all_group_type_ids(self) -> set[int]:
105134
def get_by_category(self, category: int) -> set[int]:
106135
return self._category_lookup[category]
107136

137+
def get_by_category_v2(self, category: int) -> set[int]:
138+
return self._category_lookup_v2[category]
139+
108140
def get_by_slug(self, slug: str) -> type[GroupType] | None:
109141
if slug not in self._slug_lookup:
110142
return None
@@ -160,6 +192,9 @@ class GroupType:
160192
slug: str
161193
description: str
162194
category: int
195+
# New issue category mapping (under the organizations:issue-taxonomy flag)
196+
# When GA'd, the original `category` will be removed and this will be renamed to `category`.
197+
category_v2: int
163198
noise_config: NoiseConfig | None = None
164199
default_priority: int = PriorityLevel.MEDIUM
165200
# If True this group type should be released everywhere. If False, fall back to features to
@@ -271,6 +306,7 @@ class PerformanceSlowDBQueryGroupType(PerformanceGroupTypeDefaults, GroupType):
271306
slug = "performance_slow_db_query"
272307
description = "Slow DB Query"
273308
category = GroupCategory.PERFORMANCE.value
309+
category_v2 = GroupCategory.PERFORMANCE_BEST_PRACTICE.value
274310
noise_config = NoiseConfig(ignore_limit=100)
275311
default_priority = PriorityLevel.LOW
276312
released = True
@@ -282,6 +318,7 @@ class PerformanceRenderBlockingAssetSpanGroupType(PerformanceGroupTypeDefaults,
282318
slug = "performance_render_blocking_asset_span"
283319
description = "Large Render Blocking Asset"
284320
category = GroupCategory.PERFORMANCE.value
321+
category_v2 = GroupCategory.RESPONSIVENESS.value
285322
default_priority = PriorityLevel.LOW
286323
released = True
287324
use_flagpole_for_all_features = True
@@ -293,6 +330,7 @@ class PerformanceNPlusOneGroupType(PerformanceGroupTypeDefaults, GroupType):
293330
slug = "performance_n_plus_one_db_queries"
294331
description = "N+1 Query"
295332
category = GroupCategory.PERFORMANCE.value
333+
category_v2 = GroupCategory.PERFORMANCE_BEST_PRACTICE.value
296334
default_priority = PriorityLevel.LOW
297335
released = True
298336

@@ -303,6 +341,7 @@ class PerformanceConsecutiveDBQueriesGroupType(PerformanceGroupTypeDefaults, Gro
303341
slug = "performance_consecutive_db_queries"
304342
description = "Consecutive DB Queries"
305343
category = GroupCategory.PERFORMANCE.value
344+
category_v2 = GroupCategory.PERFORMANCE_BEST_PRACTICE.value
306345
noise_config = NoiseConfig(ignore_limit=15)
307346
default_priority = PriorityLevel.LOW
308347
released = True
@@ -314,6 +353,7 @@ class PerformanceFileIOMainThreadGroupType(PerformanceGroupTypeDefaults, GroupTy
314353
slug = "performance_file_io_main_thread"
315354
description = "File IO on Main Thread"
316355
category = GroupCategory.PERFORMANCE.value
356+
category_v2 = GroupCategory.RESPONSIVENESS.value
317357
default_priority = PriorityLevel.LOW
318358
released = True
319359

@@ -324,6 +364,7 @@ class PerformanceConsecutiveHTTPQueriesGroupType(PerformanceGroupTypeDefaults, G
324364
slug = "performance_consecutive_http"
325365
description = "Consecutive HTTP"
326366
category = GroupCategory.PERFORMANCE.value
367+
category_v2 = GroupCategory.PERFORMANCE_BEST_PRACTICE.value
327368
noise_config = NoiseConfig(ignore_limit=5)
328369
default_priority = PriorityLevel.LOW
329370
released = True
@@ -335,6 +376,7 @@ class PerformanceNPlusOneAPICallsGroupType(GroupType):
335376
slug = "performance_n_plus_one_api_calls"
336377
description = "N+1 API Call"
337378
category = GroupCategory.PERFORMANCE.value
379+
category_v2 = GroupCategory.PERFORMANCE_BEST_PRACTICE.value
338380
default_priority = PriorityLevel.LOW
339381
released = True
340382

@@ -345,6 +387,7 @@ class PerformanceMNPlusOneDBQueriesGroupType(PerformanceGroupTypeDefaults, Group
345387
slug = "performance_m_n_plus_one_db_queries"
346388
description = "MN+1 Query"
347389
category = GroupCategory.PERFORMANCE.value
390+
category_v2 = GroupCategory.PERFORMANCE_BEST_PRACTICE.value
348391
default_priority = PriorityLevel.LOW
349392
released = True
350393

@@ -355,6 +398,7 @@ class PerformanceUncompressedAssetsGroupType(PerformanceGroupTypeDefaults, Group
355398
slug = "performance_uncompressed_assets"
356399
description = "Uncompressed Asset"
357400
category = GroupCategory.PERFORMANCE.value
401+
category_v2 = GroupCategory.PERFORMANCE_BEST_PRACTICE.value
358402
noise_config = NoiseConfig(ignore_limit=100)
359403
default_priority = PriorityLevel.LOW
360404
released = True
@@ -366,6 +410,7 @@ class PerformanceDBMainThreadGroupType(PerformanceGroupTypeDefaults, GroupType):
366410
slug = "performance_db_main_thread"
367411
description = "DB on Main Thread"
368412
category = GroupCategory.PERFORMANCE.value
413+
category_v2 = GroupCategory.RESPONSIVENESS.value
369414
default_priority = PriorityLevel.LOW
370415
released = True
371416

@@ -376,6 +421,7 @@ class PerformanceLargeHTTPPayloadGroupType(PerformanceGroupTypeDefaults, GroupTy
376421
slug = "performance_large_http_payload"
377422
description = "Large HTTP payload"
378423
category = GroupCategory.PERFORMANCE.value
424+
category_v2 = GroupCategory.PERFORMANCE_BEST_PRACTICE.value
379425
default_priority = PriorityLevel.LOW
380426
released = True
381427

@@ -387,6 +433,7 @@ class PerformanceHTTPOverheadGroupType(PerformanceGroupTypeDefaults, GroupType):
387433
description = "HTTP/1.1 Overhead"
388434
noise_config = NoiseConfig(ignore_limit=20)
389435
category = GroupCategory.PERFORMANCE.value
436+
category_v2 = GroupCategory.RESPONSIVENESS.value
390437
default_priority = PriorityLevel.LOW
391438
released = True
392439

@@ -397,6 +444,7 @@ class PerformanceP95EndpointRegressionGroupType(GroupType):
397444
slug = "performance_p95_endpoint_regression"
398445
description = "Endpoint Regression"
399446
category = GroupCategory.PERFORMANCE.value
447+
category_v2 = GroupCategory.PERFORMANCE_REGRESSION.value
400448
enable_auto_resolve = False
401449
enable_escalation_detection = False
402450
default_priority = PriorityLevel.MEDIUM
@@ -411,6 +459,7 @@ class PerformanceStreamedSpansGroupTypeExperimental(GroupType):
411459
slug = "performance_streamed_spans_exp"
412460
description = "Streamed Spans (Experimental)"
413461
category = GroupCategory.PERFORMANCE.value
462+
category_v2 = GroupCategory.PERFORMANCE_BEST_PRACTICE.value
414463
enable_auto_resolve = False
415464
enable_escalation_detection = False
416465
default_priority = PriorityLevel.LOW
@@ -423,6 +472,7 @@ class ProfileFileIOGroupType(GroupType):
423472
slug = "profile_file_io_main_thread"
424473
description = "File I/O on Main Thread"
425474
category = GroupCategory.PERFORMANCE.value
475+
category_v2 = GroupCategory.RESPONSIVENESS.value
426476
default_priority = PriorityLevel.LOW
427477
released = True
428478

@@ -433,6 +483,7 @@ class ProfileImageDecodeGroupType(GroupType):
433483
slug = "profile_image_decode_main_thread"
434484
description = "Image Decoding on Main Thread"
435485
category = GroupCategory.PERFORMANCE.value
486+
category_v2 = GroupCategory.RESPONSIVENESS.value
436487
default_priority = PriorityLevel.LOW
437488
released = True
438489

@@ -443,6 +494,7 @@ class ProfileJSONDecodeType(GroupType):
443494
slug = "profile_json_decode_main_thread"
444495
description = "JSON Decoding on Main Thread"
445496
category = GroupCategory.PERFORMANCE.value
497+
category_v2 = GroupCategory.RESPONSIVENESS.value
446498
default_priority = PriorityLevel.LOW
447499
released = True
448500

@@ -453,6 +505,7 @@ class ProfileRegexType(GroupType):
453505
slug = "profile_regex_main_thread"
454506
description = "Regex on Main Thread"
455507
category = GroupCategory.PERFORMANCE.value
508+
category_v2 = GroupCategory.RESPONSIVENESS.value
456509
released = True
457510
default_priority = PriorityLevel.LOW
458511

@@ -463,6 +516,7 @@ class ProfileFrameDropType(GroupType):
463516
slug = "profile_frame_drop"
464517
description = "Frame Drop"
465518
category = GroupCategory.PERFORMANCE.value
519+
category_v2 = GroupCategory.RESPONSIVENESS.value
466520
noise_config = NoiseConfig(ignore_limit=2000)
467521
released = True
468522
default_priority = PriorityLevel.LOW
@@ -474,6 +528,7 @@ class ProfileFunctionRegressionType(GroupType):
474528
slug = "profile_function_regression"
475529
description = "Function Regression"
476530
category = GroupCategory.PERFORMANCE.value
531+
category_v2 = GroupCategory.PERFORMANCE_BEST_PRACTICE.value
477532
enable_auto_resolve = False
478533
released = True
479534
default_priority = PriorityLevel.MEDIUM
@@ -486,6 +541,7 @@ class MonitorIncidentType(GroupType):
486541
slug = "monitor_check_in_failure"
487542
description = "Crons Monitor Failed"
488543
category = GroupCategory.CRON.value
544+
category_v2 = GroupCategory.OUTAGE.value
489545
released = True
490546
creation_quota = Quota(3600, 60, 60_000) # 60,000 per hour, sliding window of 60 seconds
491547
default_priority = PriorityLevel.HIGH
@@ -515,6 +571,7 @@ class ReplayRageClickType(ReplayGroupTypeDefaults, GroupType):
515571
slug = "replay_click_rage"
516572
description = "Rage Click Detected"
517573
category = GroupCategory.REPLAY.value
574+
category_v2 = GroupCategory.USER_EXPERIENCE.value
518575
default_priority = PriorityLevel.MEDIUM
519576
notification_config = NotificationConfig()
520577
released = True
@@ -526,6 +583,7 @@ class ReplayHydrationErrorType(ReplayGroupTypeDefaults, GroupType):
526583
slug = "replay_hydration_error"
527584
description = "Hydration Error Detected"
528585
category = GroupCategory.REPLAY.value
586+
category_v2 = GroupCategory.USER_EXPERIENCE.value
529587
default_priority = PriorityLevel.MEDIUM
530588
notification_config = NotificationConfig()
531589
released = True
@@ -537,6 +595,7 @@ class FeedbackGroup(GroupType):
537595
slug = "feedback"
538596
description = "Feedback"
539597
category = GroupCategory.FEEDBACK.value
598+
category_v2 = GroupCategory.FEEDBACK.value
540599
creation_quota = Quota(3600, 60, 1000) # 1000 per hour, sliding window of 60 seconds
541600
default_priority = PriorityLevel.MEDIUM
542601
notification_config = NotificationConfig(context=[])
@@ -552,6 +611,7 @@ class MetricIssuePOC(GroupType):
552611
slug = "metric_issue_poc"
553612
description = "Metric Issue POC"
554613
category = GroupCategory.METRIC_ALERT.value
614+
category_v2 = GroupCategory.PERFORMANCE_REGRESSION.value
555615
default_priority = PriorityLevel.HIGH
556616
enable_auto_resolve = False
557617
enable_escalation_detection = False

src/sentry/uptime/grouptype.py

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class UptimeDomainCheckFailure(GroupType):
1515
slug = "uptime_domain_failure"
1616
description = "Uptime Domain Monitor Failure"
1717
category = GroupCategory.UPTIME.value
18+
category_v2 = GroupCategory.OUTAGE.value
1819
creation_quota = Quota(3600, 60, 1000) # 1000 per hour, sliding window of 60 seconds
1920
default_priority = PriorityLevel.HIGH
2021
enable_auto_resolve = False

0 commit comments

Comments
 (0)