Skip to content

ref(seer grouping): Add ability to ignore useless filenames #85277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/sentry/seer/similarity/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
"javascript;base64",
]

IGNORED_FILENAMES = ["<compiler-generated>"]


class ReferrerOptions(StrEnum):
INGEST = "ingest"
Expand Down Expand Up @@ -239,6 +241,8 @@ def extract_filename(frame_dict: Mapping[str, Any]) -> str:
Extract the filename from the frame dictionary. Fallback to module if filename is not present.
"""
filename = frame_dict["filename"]
if filename in IGNORED_FILENAMES:
filename = ""
if filename == "" and frame_dict["module"] != "":
filename = frame_dict["module"]
return filename
Expand Down
16 changes: 16 additions & 0 deletions tests/sentry/seer/similarity/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from sentry.grouping.variants import CustomFingerprintVariant
from sentry.seer.similarity.utils import (
BASE64_ENCODED_PREFIXES,
IGNORED_FILENAMES,
MAX_FRAME_COUNT,
ReferrerOptions,
_is_snipped_context_line,
Expand Down Expand Up @@ -811,6 +812,21 @@ def test_no_filename_or_module(self):
== 'ZeroDivisionError: division by zero\n File "None", function divide_by_zero\n divide = 1/0'
)

def test_ignores_meaningless_filenames(self):
for ignored_filename in IGNORED_FILENAMES:
exception = copy.deepcopy(self.BASE_APP_DATA)
# delete module from the exception so we don't fall back to that
del exception["app"]["component"]["values"][0]["values"][0]["values"][0]["values"][0]
# replace filename with ignored value
exception["app"]["component"]["values"][0]["values"][0]["values"][0]["values"][0][
"values"
][0] = ignored_filename
stacktrace_string = get_stacktrace_string(exception)
assert (
stacktrace_string
== 'ZeroDivisionError: division by zero\n File "None", function divide_by_zero\n divide = 1/0'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None is there ✅

)

@patch("sentry.seer.similarity.utils.metrics")
def test_no_header_one_frame_no_filename(self, mock_metrics):
exception = copy.deepcopy(self.MOBILE_THREAD_DATA)
Expand Down
Loading