-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(grouping): Exception Groups (#48653)
Implements issue grouping and titling changes required for processing exception groups per [Sentry RFC 79](https://github.com/getsentry/rfcs/blob/main/text/0079-exception-groups.md#sentry-issue-grouping). Part of #37716 A few notes: - The issue titling requirements were implemented by dropping a `main_exception_id` on the event data in the exception grouping logic, and then later using it in the `ErrorEvent.extract_metadata` function. If present, it uses the corresponding exception for metadata including the title. This is working well, but just wanted to check if this is safe, or if there's a better way. - In the RFC, I had indicated that disparate top-level exceptions would be grouped under their immediate parent exception, which might not necessarily be the root exception. This turned out to be difficult to implement, and didn't add much value. Instead, I always use the root exception. This seems to work well enough. I included a comment at the appropriate place in the code, in case it comes up in the future. - I only modified the `NewStyle` strategy. I'm not sure if `Legacy` or other strategies should be updated as well? - I fixed a related bug in `exception.py`, which was that the first exception was being used to create default issue tags instead of the last. This should be done regardless of exception groups, as it corrects the `handled` and `mechanism` event tags such that they are for the outermost (latest) exception. Tests are updated to match this change as well.
- Loading branch information
1 parent
adcc680
commit f4fa54e
Showing
127 changed files
with
3,307 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 115 additions & 0 deletions
115
...erfaces/snapshots/test_exception/test_context_with_two_exceptions_having_mechanism.pysnap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
--- | ||
created: '2023-05-05T19:28:49.100372Z' | ||
creator: sentry | ||
source: tests/sentry/event_manager/interfaces/test_exception.py | ||
--- | ||
errors: null | ||
get_api_context: | ||
excOmitted: null | ||
hasSystemFrames: true | ||
values: | ||
- mechanism: | ||
exception_id: 1 | ||
handled: true | ||
parent_id: 0 | ||
source: __context__ | ||
type: chained | ||
module: foo.bar | ||
rawStacktrace: null | ||
stacktrace: | ||
frames: | ||
- absPath: foo/baz.py | ||
colNo: null | ||
context: [] | ||
errors: null | ||
filename: foo/baz.py | ||
function: null | ||
inApp: true | ||
instructionAddr: null | ||
lineNo: 1 | ||
module: null | ||
package: null | ||
platform: null | ||
rawFunction: null | ||
symbol: null | ||
symbolAddr: null | ||
trust: null | ||
vars: null | ||
framesOmitted: null | ||
hasSystemFrames: true | ||
registers: null | ||
threadId: null | ||
type: ValueError | ||
value: hello world | ||
- mechanism: | ||
exception_id: 0 | ||
handled: false | ||
is_exception_group: true | ||
source: __context__ | ||
type: generic | ||
module: foo.bar | ||
rawStacktrace: null | ||
stacktrace: | ||
frames: | ||
- absPath: foo/baz.py | ||
colNo: null | ||
context: [] | ||
errors: null | ||
filename: foo/baz.py | ||
function: null | ||
inApp: true | ||
instructionAddr: null | ||
lineNo: 1 | ||
module: null | ||
package: null | ||
platform: null | ||
rawFunction: null | ||
symbol: null | ||
symbolAddr: null | ||
trust: null | ||
vars: null | ||
framesOmitted: null | ||
hasSystemFrames: true | ||
registers: null | ||
threadId: null | ||
type: ValueError | ||
value: hello world | ||
tags: | ||
- - handled | ||
- 'no' | ||
- - mechanism | ||
- generic | ||
to_json: | ||
values: | ||
- mechanism: | ||
exception_id: 1 | ||
handled: true | ||
parent_id: 0 | ||
source: __context__ | ||
type: chained | ||
module: foo.bar | ||
stacktrace: | ||
frames: | ||
- abs_path: foo/baz.py | ||
filename: foo/baz.py | ||
in_app: true | ||
lineno: 1 | ||
type: ValueError | ||
value: hello world | ||
- mechanism: | ||
exception_id: 0 | ||
handled: false | ||
is_exception_group: true | ||
source: __context__ | ||
type: generic | ||
module: foo.bar | ||
stacktrace: | ||
frames: | ||
- abs_path: foo/baz.py | ||
filename: foo/baz.py | ||
in_app: true | ||
lineno: 1 | ||
type: ValueError | ||
value: hello world | ||
to_string: "ValueError: hello world\n File \"foo/baz.py\", line 1\n\nValueError:\ | ||
\ hello world\n File \"foo/baz.py\", line 1" |
Oops, something went wrong.