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

Fix issue with flask url handler returning an iterator. #3755

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

Conversation

weimzh
Copy link

@weimzh weimzh commented Nov 10, 2024

If the iterator does some actual job then yield's part of response, sentry sdk would not catch anything after the url handler itself returned, and will miss everything being done in the iterator. This fixes the issue.

If the iterator does some actual job then yield's part of response, sentry sdk would not catch anything after the url handler itself returned, and will miss everything being done in the iterator. This fixes the issue.

Signed-off-by: Wei Mingzhi <whistler_wmz@users.sf.net>
@sentrivana
Copy link
Contributor

Heya @weimzh, thanks for the PR! Just looking at the code the changes look good to me. Also tested locally with a small Flask app that has an iterator response that throws an exception eventually, and the SDK captures it with your diff. So that looks good.

However, it looks like the change breaks quite a number of tests so we'll need to fix that. Do you have time to look into it?

Copy link

codecov bot commented Nov 19, 2024

Codecov Report

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

Project coverage is 79.54%. Comparing base (1bd744d) to head (3fedc7e).

Files with missing lines Patch % Lines
sentry_sdk/integrations/wsgi.py 50.00% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3755      +/-   ##
==========================================
- Coverage   79.87%   79.54%   -0.33%     
==========================================
  Files         137      137              
  Lines       15371    15376       +5     
  Branches     2608     2611       +3     
==========================================
- Hits        12277    12231      -46     
- Misses       2223     2277      +54     
+ Partials      871      868       -3     
Files with missing lines Coverage Δ
sentry_sdk/integrations/wsgi.py 81.33% <50.00%> (-3.50%) ⬇️

... and 17 files with indirect coverage changes

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.

2 participants