-
Notifications
You must be signed in to change notification settings - Fork 571
Add missing stack frames #3673
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
Merged
Add missing stack frames #3673
Changes from 14 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
7198a75
extract full stack frame and give it to where it is needed
antonpirker 8ae7d34
Adding missing frames
antonpirker e69ca9a
Added some todos
antonpirker 5abd334
Merge branch 'master' into antonpirker/missing-stack-trames
antonpirker 3645218
Have full frames of the full stack trace
antonpirker 31d059c
Added full frames to full_stack
antonpirker 8d2490b
Merge branch 'master' into antonpirker/missing-stack-trames
antonpirker 7189be1
Merge branch 'master' into antonpirker/missing-stack-trames
antonpirker 5e4c6a7
Merge branch 'master' into antonpirker/missing-stack-trames
antonpirker 4dbf661
Improvements
antonpirker 04f79ed
linting
antonpirker e4f3397
Make it more resilient againt misuse
antonpirker 39db548
Cleanup
antonpirker 10d7a49
Added tests
antonpirker 9a0c373
Merge branch 'master' into antonpirker/missing-stack-trames
antonpirker 9dae6f8
trying something
antonpirker 5960242
Use new clickhouse gh action
antonpirker abef705
Merge branch 'master' into antonpirker/missing-stack-trames
antonpirker 9f8bc18
Merge branch 'master' into antonpirker/missing-stack-trames
antonpirker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,103 @@ | ||
| import sentry_sdk | ||
|
|
||
|
|
||
| def test_full_stack_frames_default(sentry_init, capture_events): | ||
| sentry_init() | ||
| events = capture_events() | ||
|
|
||
| def foo(): | ||
| try: | ||
| bar() | ||
| except Exception as e: | ||
| sentry_sdk.capture_exception(e) | ||
|
|
||
| def bar(): | ||
| raise Exception("This is a test exception") | ||
|
|
||
| foo() | ||
|
|
||
| (event,) = events | ||
| frames = event["exception"]["values"][0]["stacktrace"]["frames"] | ||
|
|
||
| assert len(frames) == 2 | ||
| assert frames[-1]["function"] == "bar" | ||
| assert frames[-2]["function"] == "foo" | ||
|
|
||
|
|
||
| def test_full_stack_frames_enabled(sentry_init, capture_events): | ||
| sentry_init( | ||
| add_full_stack=True, | ||
| ) | ||
| events = capture_events() | ||
|
|
||
| def foo(): | ||
| try: | ||
| bar() | ||
| except Exception as e: | ||
| sentry_sdk.capture_exception(e) | ||
|
|
||
| def bar(): | ||
| raise Exception("This is a test exception") | ||
|
|
||
| foo() | ||
|
|
||
| (event,) = events | ||
| frames = event["exception"]["values"][0]["stacktrace"]["frames"] | ||
|
|
||
| assert len(frames) > 2 | ||
| assert frames[-1]["function"] == "bar" | ||
| assert frames[-2]["function"] == "foo" | ||
| assert frames[-3]["function"] == "foo" | ||
| assert frames[-4]["function"] == "test_full_stack_frames_enabled" | ||
|
|
||
|
|
||
| def test_full_stack_frames_enabled_truncated(sentry_init, capture_events): | ||
| sentry_init( | ||
| add_full_stack=True, | ||
| max_stack_frames=3, | ||
| ) | ||
| events = capture_events() | ||
|
|
||
| def foo(): | ||
| try: | ||
| bar() | ||
| except Exception as e: | ||
| sentry_sdk.capture_exception(e) | ||
|
|
||
| def bar(): | ||
| raise Exception("This is a test exception") | ||
|
|
||
| foo() | ||
|
|
||
| (event,) = events | ||
| frames = event["exception"]["values"][0]["stacktrace"]["frames"] | ||
|
|
||
| assert len(frames) == 3 | ||
| assert frames[-1]["function"] == "bar" | ||
| assert frames[-2]["function"] == "foo" | ||
| assert frames[-3]["function"] == "foo" | ||
|
|
||
|
|
||
| def test_full_stack_frames_default_no_truncation_happening(sentry_init, capture_events): | ||
| sentry_init( | ||
| max_stack_frames=1, # this is ignored if add_full_stack=False (which is the default) | ||
| ) | ||
| events = capture_events() | ||
|
|
||
| def foo(): | ||
| try: | ||
| bar() | ||
| except Exception as e: | ||
| sentry_sdk.capture_exception(e) | ||
|
|
||
| def bar(): | ||
| raise Exception("This is a test exception") | ||
|
|
||
| foo() | ||
|
|
||
| (event,) = events | ||
| frames = event["exception"]["values"][0]["stacktrace"]["frames"] | ||
|
|
||
| assert len(frames) == 2 | ||
| assert frames[-1]["function"] == "bar" | ||
| assert frames[-2]["function"] == "foo" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.