From 839c94d64a0998d1a44d0124faffa29a0d8cd1ee Mon Sep 17 00:00:00 2001 From: Katie Byers Date: Thu, 19 Dec 2024 14:58:22 -0800 Subject: [PATCH] remove `get_stacktrace_string_with_metrics` --- src/sentry/grouping/ingest/seer.py | 8 +++----- src/sentry/seer/similarity/utils.py | 10 ---------- src/sentry/tasks/embeddings_grouping/utils.py | 4 ++-- tests/sentry/seer/similarity/test_utils.py | 3 +-- 4 files changed, 6 insertions(+), 19 deletions(-) diff --git a/src/sentry/grouping/ingest/seer.py b/src/sentry/grouping/ingest/seer.py index e4a5803087c631..5d100bcd3a71c2 100644 --- a/src/sentry/grouping/ingest/seer.py +++ b/src/sentry/grouping/ingest/seer.py @@ -20,7 +20,7 @@ ReferrerOptions, event_content_has_stacktrace, filter_null_from_string, - get_stacktrace_string_with_metrics, + get_stacktrace_string, has_too_many_contributing_frames, killswitch_enabled, record_did_call_seer_metric, @@ -200,9 +200,7 @@ def _circuit_breaker_broken(event: Event, project: Project) -> bool: def _has_empty_stacktrace_string(event: Event, variants: dict[str, BaseVariant]) -> bool: - stacktrace_string = get_stacktrace_string_with_metrics( - get_grouping_info_from_variants(variants) - ) + stacktrace_string = get_stacktrace_string(get_grouping_info_from_variants(variants)) if not stacktrace_string: if stacktrace_string == "": record_did_call_seer_metric(call_made=False, blocker="empty-stacktrace-string") @@ -228,7 +226,7 @@ def get_seer_similar_issues( stacktrace_string = event.data.get( "stacktrace_string", - get_stacktrace_string_with_metrics(get_grouping_info_from_variants(variants)), + get_stacktrace_string(get_grouping_info_from_variants(variants)), ) if not stacktrace_string: diff --git a/src/sentry/seer/similarity/utils.py b/src/sentry/seer/similarity/utils.py index d8f1cab48f4135..3a8d282776b9db 100644 --- a/src/sentry/seer/similarity/utils.py +++ b/src/sentry/seer/similarity/utils.py @@ -278,16 +278,6 @@ def is_base64_encoded_frame(frame_dict: Mapping[str, Any]) -> bool: return base64_encoded -def get_stacktrace_string_with_metrics(data: dict[str, Any]) -> str | None: - stacktrace_string = None - try: - stacktrace_string = get_stacktrace_string(data) - except Exception: - logger.exception("Unexpected exception in stacktrace string formatting") - - return stacktrace_string - - def event_content_has_stacktrace(event: GroupEvent | Event) -> bool: # If an event has no stacktrace, there's no data for Seer to analyze, so no point in making the # API call. If we ever start analyzing message-only events, we'll need to add `event.title in diff --git a/src/sentry/tasks/embeddings_grouping/utils.py b/src/sentry/tasks/embeddings_grouping/utils.py index d87bf9296b4f8f..b6b0d44fc2ea84 100644 --- a/src/sentry/tasks/embeddings_grouping/utils.py +++ b/src/sentry/tasks/embeddings_grouping/utils.py @@ -34,7 +34,7 @@ ReferrerOptions, event_content_has_stacktrace, filter_null_from_string, - get_stacktrace_string_with_metrics, + get_stacktrace_string, has_too_many_contributing_frames, ) from sentry.snuba.dataset import Dataset @@ -364,7 +364,7 @@ def get_events_from_nodestore( if not has_too_many_contributing_frames(event, variants, ReferrerOptions.BACKFILL): grouping_info = get_grouping_info_from_variants(variants) - stacktrace_string = get_stacktrace_string_with_metrics(grouping_info) + stacktrace_string = get_stacktrace_string(grouping_info) if not stacktrace_string: invalid_event_group_ids.append(group_id) diff --git a/tests/sentry/seer/similarity/test_utils.py b/tests/sentry/seer/similarity/test_utils.py index 063a7a261c9f23..60ecc4ebdc8528 100644 --- a/tests/sentry/seer/similarity/test_utils.py +++ b/tests/sentry/seer/similarity/test_utils.py @@ -15,7 +15,6 @@ _is_snipped_context_line, filter_null_from_string, get_stacktrace_string, - get_stacktrace_string_with_metrics, has_too_many_contributing_frames, ) from sentry.testutils.cases import TestCase @@ -796,7 +795,7 @@ def test_replace_file_with_module(self): exception = copy.deepcopy(self.BASE_APP_DATA) # delete filename from the exception del exception["app"]["component"]["values"][0]["values"][0]["values"][0]["values"][1] - stacktrace_string = get_stacktrace_string_with_metrics(exception) + stacktrace_string = get_stacktrace_string(exception) assert ( stacktrace_string == 'ZeroDivisionError: division by zero\n File "__main__", function divide_by_zero\n divide = 1/0'