Skip to content

Commit

Permalink
remove get_stacktrace_string_with_metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
lobsterkatie committed Dec 20, 2024
1 parent 994f75d commit 839c94d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 19 deletions.
8 changes: 3 additions & 5 deletions src/sentry/grouping/ingest/seer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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")
Expand All @@ -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:
Expand Down
10 changes: 0 additions & 10 deletions src/sentry/seer/similarity/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/sentry/tasks/embeddings_grouping/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions tests/sentry/seer/similarity/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit 839c94d

Please sign in to comment.