Skip to content
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

Add missing stack frames #3673

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

Conversation

antonpirker
Copy link
Member

@antonpirker antonpirker commented Oct 18, 2024

Add a new init() option add_full_stack (default False), when set to True it will add all the missing frames from the beginning of the execution to the stack trace sent to Sentry.

Also adds another option max_stack_frames (default 100) to limit the number of frames sent. The limitation is only enforced when add_full_stack=True to not change behavior for existing users.

Documentation update: getsentry/sentry-docs#11844

Fixes #3646

Copy link

codecov bot commented Oct 19, 2024

Codecov Report

Attention: Patch coverage is 90.90909% with 3 lines in your changes missing coverage. Please review.

Project coverage is 84.36%. Comparing base (da0b086) to head (10d7a49).

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
sentry_sdk/utils.py 90.32% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3673      +/-   ##
==========================================
+ Coverage   84.30%   84.36%   +0.06%     
==========================================
  Files         137      137              
  Lines       14561    14592      +31     
  Branches     2460     2468       +8     
==========================================
+ Hits        12275    12310      +35     
+ Misses       1528     1523       -5     
- Partials      758      759       +1     
Files with missing lines Coverage Δ
sentry_sdk/consts.py 99.52% <100.00%> (+<0.01%) ⬆️
sentry_sdk/utils.py 86.06% <90.32%> (+0.13%) ⬆️

... and 4 files with indirect coverage changes

@antonpirker antonpirker self-assigned this Oct 21, 2024
@BYK BYK changed the title Add missing stack trames Add missing stack frames Oct 24, 2024
Comment on lines +1134 to +1135
if "sentry_sdk" in frame.f_code.co_filename:
in_sdk = True
Copy link
Member

@asottile-sentry asottile-sentry Nov 18, 2024

Choose a reason for hiding this comment

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

might be better to use f_globals['__module__'] as this is a pretty weak assertion currently

@@ -1096,6 +1119,73 @@ def exc_info_from_error(error):
return exc_info


def get_full_stack():
Copy link
Member

Choose a reason for hiding this comment

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

should this replace the code in the logging plugin which does similar?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing execution stack and output for handled errors
2 participants