fix(flask): response streaming
Description
-
Blocked by: https://github.com/DataDog/dd-trace-py/pull/4303
-
Use ddtrace wsgi middleware to trace flask applications. This ensures flask responses are traced and it's duration is captured in the flask.request span.
-
Update flask test client to close response. This ensures the request and response spans are finished.
-
Adds test case for response streaming in flask
-
Update flask snapshots and tests to include
flask.applicationandflask.responsespans
Checklist
- [ ] Title must conform to conventional commit.
- [ ] Add additional sections for
featandfixpull requests. - [ ] Ensure tests are passing for affected code.
- [ ] Library documentation and/or Datadog's documentation site is updated. Link to doc PR in description.
Motivation
Design
Testing strategy
Relevant issue(s)
Testing strategy
Reviewer Checklist
- [ ] Title is accurate.
- [ ] Description motivates each change.
- [ ] No unnecessary changes were introduced in this PR.
- [ ] PR cannot be broken up into smaller PRs.
- [ ] Avoid breaking API changes unless absolutely necessary.
- [ ] Tests provided or description of manual testing performed is included in the code or PR.
- [ ] Release note has been added for fixes and features, or else
changelog/no-changeloglabel added. - [ ] All relevant GitHub issues are correctly linked.
- [ ] Backports are identified and tagged with Mergifyio.
- [ ] Add to milestone.
Using a generator function raised session issues in SQLAlchemy.
@mabdinur can you include the relevant exception and traceback?
Codecov Report
Merging #4202 (0bbfbbc) into 1.x (fdcefa9) will decrease coverage by
0.04%. The diff coverage is0.00%.
@@ Coverage Diff @@
## 1.x #4202 +/- ##
==========================================
- Coverage 77.97% 77.92% -0.05%
==========================================
Files 760 760
Lines 60288 60319 +31
==========================================
- Hits 47007 47006 -1
- Misses 13281 13313 +32
| Impacted Files | Coverage Δ | |
|---|---|---|
| ddtrace/contrib/flask/patch.py | 0.00% <0.00%> (ø) |
|
| tests/contrib/flask/__init__.py | 0.00% <0.00%> (ø) |
|
| tests/contrib/flask/test_hooks.py | 0.00% <0.00%> (ø) |
|
| tests/contrib/flask/test_request.py | 0.00% <0.00%> (ø) |
|
| tests/contrib/flask/test_static.py | 0.00% <0.00%> (ø) |
|
| ...ts/contrib/flask_autopatch/test_flask_autopatch.py | 0.00% <0.00%> (ø) |
|
| tests/utils.py | 90.35% <0.00%> (-0.24%) |
:arrow_down: |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
@mabdinur this pull request is now in conflict 😩
backport 1.5 1.6
✅ Backports have been created
- #4624 feat(flask): response streaming (backport #4202) has been created for branch
1.5 - #4625 feat(flask): response streaming (backport #4202) has been created for branch
1.6
@mabdinur this pull request is now in conflict 😩
It might be nice to see the same request flamegraph before and after for reference, but looking at the snapshots you can figure it out so just a nit.
@mabdinur this pull request is now in conflict 😩
@mabdinur this pull request is now in conflict 😩
We should check the flask-poc system tests job to make sure we didn't break that. It looks like all the system tests jobs are failing though.