Add ASGI support to Django (backport #2656)#2752
Merged
mergify[bot] merged 2 commits into0.51from Aug 10, 2021
Merged
Conversation
* Add ASGI support to Django
Using the ASGI middleware we can relatively cleanly add async/ASGI
support for Django.
The previous method of instrumentation was first attempted but it was
decided against for a couple reasons:
- Tracing the ASGI application would require more than just wrapping
the get_response_async method (although this would provide most of
the visibility desired) as we'd need to trace the invocation of the
response method.
- We already have an ASGI middleware implementation.
* Store span in ASGI scope
* Don't override distributed tracing setting
It gets reused by the ASGI middleware
* Don't wrap the asgi application when get_response is used for async
* Update ddtrace/contrib/django/patch.py
Co-authored-by: Tahir H. Butt <tahir.butt@datadoghq.com>
Co-authored-by: Brett Langdon <me@brett.is>
(cherry picked from commit 71ca68d)
# Conflicts:
# tests/contrib/django/asgi.py
# tests/snapshots/tests.contrib.django.test_django_snapshots.test_asgi_200_30.snap
# tests/snapshots/tests.contrib.django.test_django_snapshots.test_asgi_200_31.snap
# tests/snapshots/tests.contrib.django.test_django_snapshots.test_asgi_200_3x.snap
# tests/snapshots/tests.contrib.django.test_django_snapshots.test_asgi_500_30.snap
# tests/snapshots/tests.contrib.django.test_django_snapshots.test_asgi_500_31.snap
# tests/snapshots/tests.contrib.django.test_django_snapshots.test_asgi_500_3x.snap
brettlangdon
approved these changes
Aug 9, 2021
Codecov Report
@@ Coverage Diff @@
## 0.51 #2752 +/- ##
=======================================
Coverage ? 84.93%
=======================================
Files ? 591
Lines ? 43113
Branches ? 0
=======================================
Hits ? 36617
Misses ? 6496
Partials ? 0 Continue to review full report at Codecov.
|
brettlangdon
approved these changes
Aug 10, 2021
majorgreys
approved these changes
Aug 10, 2021
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is an automatic backport of pull request #2656 done by Mergify.
Cherry-pick of 71ca68d has failed:
To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/github/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally
Mergify commands and options
More conditions and actions can be found in the documentation.
You can also trigger Mergify actions by commenting on this pull request:
@Mergifyio refreshwill re-evaluate the rules@Mergifyio rebasewill rebase this PR on its base branch@Mergifyio updatewill merge the base branch into this PR@Mergifyio backport <destination>will backport this PR on<destination>branchAdditionally, on Mergify dashboard you can:
Finally, you can contact us on https://mergify.io/