Skip to content

ref(grouping): Consolidate main exception id override logic #97541

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Next Next commit
move setting new main exception id into helper
  • Loading branch information
lobsterkatie committed Aug 8, 2025
commit e9830cf0839cde53e3fde5e982e108a133c36c49
9 changes: 4 additions & 5 deletions src/sentry/grouping/strategies/newstyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,9 +644,7 @@ def chained_exception(

# Check for cases in which we want to switch the `main_exception_id` in order to use a different
# exception than normal for the event title
main_exception_id = determine_main_exception_id(exceptions)
if main_exception_id:
event.data["main_exception_id"] = main_exception_id
determine_main_exception_id(event, exceptions)

for exception in exceptions:
for variant_name, component in exception_components_by_exception[id(exception)].items():
Expand Down Expand Up @@ -900,11 +898,12 @@ def react_error_with_cause(exceptions: list[SingleException]) -> int | None:
]


def determine_main_exception_id(exceptions: list[SingleException]) -> int | None:
def determine_main_exception_id(event: Event, exceptions: list[SingleException]) -> None:
main_exception_id = None
for func in MAIN_EXCEPTION_ID_FUNCS:
main_exception_id = func(exceptions)
if main_exception_id is not None:
break

return main_exception_id
if main_exception_id:
event.data["main_exception_id"] = main_exception_id