From 9d4715501d417f7a1e5bc446b96c97e831ae8894 Mon Sep 17 00:00:00 2001 From: Armen Zambrano G <44410+armenzg@users.noreply.github.com> Date: Mon, 2 Dec 2024 13:18:50 -0500 Subject: [PATCH 1/3] feat(grouping): Blacklist a list of platforms instead of whitelisting it In #81385, we whitelisted a list of platforms that would be prevented from sending seer more than 30 system contributing frames. Changing it to a blacklist allows adding new platforms without requirying to opt them in to the new behaviour. Over time, we should move more platforms from the blacklist to the whitelist. --- src/sentry/seer/similarity/utils.py | 39 ++++++++++++++--------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/src/sentry/seer/similarity/utils.py b/src/sentry/seer/similarity/utils.py index b92fd1858d81df..56d1f9b579edda 100644 --- a/src/sentry/seer/similarity/utils.py +++ b/src/sentry/seer/similarity/utils.py @@ -25,17 +25,14 @@ "ruby", ] ) -SEER_ELIGIBLE_PLATFORMS = frozenset( +# An original set of platforms were backfilled allowing more than 30 system contributing frames +# being set to seer. Unfortunately, this can cause over grouping. We will need to reduce +# these set of platforms but for now we will blacklist them. +SYSTEM_FRAME_CHECK_BLACKLIST_PLATFORMS = frozenset( [ - "android", - "android-profiling-onboarding-1-install", - "android-profiling-onboarding-3-configure-profiling", - "android-profiling-onboarding-4-upload", "bun", - "dart", "deno", "django", - "flutter", "go", "go-echo", "go-fasthttp", @@ -45,16 +42,6 @@ "go-iris", "go-martini", "go-negroni", - "groovy", - "java", - "java-android", - "java-appengine", - "java-log4j", - "java-log4j2", - "java-logging", - "java-logback", - "java-spring", - "java-spring-boot", "javascript", "javascript-angular", "javascript-angularjs", @@ -144,8 +131,16 @@ "ruby-rails", ] ) -SYSTEM_FRAME_CHECK_PLATFORMS = frozenset( - [ +SEER_ELIGIBLE_PLATFORMS = frozenset( + SYSTEM_FRAME_CHECK_BLACKLIST_PLATFORMS + + [ + "android", + "android-profiling-onboarding-1-install", + "android-profiling-onboarding-3-configure-profiling", + "android-profiling-onboarding-4-upload", + "dart", + "flutter", + "groovy", "java", "java-android", "java-appengine", @@ -293,7 +288,11 @@ def _process_frames(frames: list[dict[str, Any]]) -> list[str]: exc_value = _get_value_if_exists(exception_value) elif exception_value.get("id") == "stacktrace" and frame_count < MAX_FRAME_COUNT: frame_strings = _process_frames(exception_value["values"]) - if platform in SYSTEM_FRAME_CHECK_PLATFORMS and is_frames_truncated and not app_hash: + if ( + platform not in SYSTEM_FRAME_CHECK_BLACKLIST_PLATFORMS + and is_frames_truncated + and not app_hash + ): raise TooManyOnlySystemFramesException if has_no_filename_or_module: raise NoFilenameOrModuleException From 1f681eae9193e0e1243f5c568c2f01613c179350 Mon Sep 17 00:00:00 2001 From: Armen Zambrano G <44410+armenzg@users.noreply.github.com> Date: Mon, 2 Dec 2024 13:28:50 -0500 Subject: [PATCH 2/3] Fix typing --- src/sentry/seer/similarity/utils.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/sentry/seer/similarity/utils.py b/src/sentry/seer/similarity/utils.py index 56d1f9b579edda..25288457741680 100644 --- a/src/sentry/seer/similarity/utils.py +++ b/src/sentry/seer/similarity/utils.py @@ -131,9 +131,8 @@ "ruby-rails", ] ) -SEER_ELIGIBLE_PLATFORMS = frozenset( - SYSTEM_FRAME_CHECK_BLACKLIST_PLATFORMS - + [ +SEER_ELIGIBLE_PLATFORMS = SYSTEM_FRAME_CHECK_BLACKLIST_PLATFORMS | frozenset( + [ "android", "android-profiling-onboarding-1-install", "android-profiling-onboarding-3-configure-profiling", From 35d2f8affc9c8ce2dfc281300db56f4c7f7a34b4 Mon Sep 17 00:00:00 2001 From: Armen Zambrano G <44410+armenzg@users.noreply.github.com> Date: Tue, 3 Dec 2024 08:35:22 -0500 Subject: [PATCH 3/3] Fix test --- tests/sentry/seer/similarity/test_utils.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/tests/sentry/seer/similarity/test_utils.py b/tests/sentry/seer/similarity/test_utils.py index 25a2efad431a03..c5ca9ee76dd1a9 100644 --- a/tests/sentry/seer/similarity/test_utils.py +++ b/tests/sentry/seer/similarity/test_utils.py @@ -736,10 +736,7 @@ def test_too_many_system_frames_single_exception_invalid_platform(self): "values" ] += self.create_frames(MAX_FRAME_COUNT + 1, True) - stacktrace_string = get_stacktrace_string(data_system) - assert stacktrace_string is not None and stacktrace_string != "" - - stacktrace_string = get_stacktrace_string(data_system, platform="python") + stacktrace_string = get_stacktrace_string(data_system, "python") assert stacktrace_string is not None and stacktrace_string != "" def test_too_many_system_frames_chained_exception(self): @@ -767,16 +764,13 @@ def test_too_many_system_frames_chained_exception_invalid_platform(self): "values" ] += self.create_frames(MAX_FRAME_COUNT // 2, True) - stacktrace_string = get_stacktrace_string(data_system) - assert stacktrace_string is not None and stacktrace_string != "" - - stacktrace_string = get_stacktrace_string(data_system, platform="python") + stacktrace_string = get_stacktrace_string(data_system, "python") assert stacktrace_string is not None and stacktrace_string != "" def test_too_many_in_app_contributing_frames(self): """ Check that when there are over MAX_FRAME_COUNT contributing frames, the last MAX_FRAME_COUNT - are included. + is included. """ data_frames = copy.deepcopy(self.BASE_APP_DATA) # Create 30 contributing frames, 1-20 -> last 10 should be included @@ -791,7 +785,7 @@ def test_too_many_in_app_contributing_frames(self): data_frames["app"]["component"]["values"][0]["values"][0]["values"] += self.create_frames( 20, True, 41 ) - stacktrace_str = get_stacktrace_string(data_frames) + stacktrace_str = get_stacktrace_string(data_frames, "java") num_frames = 0 for i in range(1, 11):