Skip to content

Add ASGI support to Django (backport #2656)#2752

Merged
mergify[bot] merged 2 commits into0.51from
mergify/bp/0.51/pr-2656
Aug 10, 2021
Merged

Add ASGI support to Django (backport #2656)#2752
mergify[bot] merged 2 commits into0.51from
mergify/bp/0.51/pr-2656

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Aug 9, 2021

This is an automatic backport of pull request #2656 done by Mergify.
Cherry-pick of 71ca68d has failed:

On branch mergify/bp/0.51/pr-2656
Your branch is up to date with 'origin/0.51'.

You are currently cherry-picking commit 71ca68d6.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	new file:   ddtrace/contrib/django/_asgi.py
	modified:   ddtrace/contrib/django/patch.py
	modified:   docs/spelling_wordlist.txt
	new file:   releasenotes/notes/django-asgi-69a53398d9596679.yaml
	modified:   tests/contrib/django/django1_app/settings.py

Unmerged paths:
  (use "git add/rm <file>..." as appropriate to mark resolution)
	deleted by us:   tests/contrib/django/asgi.py
	deleted by us:   tests/snapshots/tests.contrib.django.test_django_snapshots.test_asgi_200_30.snap
	deleted by us:   tests/snapshots/tests.contrib.django.test_django_snapshots.test_asgi_200_31.snap
	deleted by us:   tests/snapshots/tests.contrib.django.test_django_snapshots.test_asgi_200_3x.snap
	deleted by us:   tests/snapshots/tests.contrib.django.test_django_snapshots.test_asgi_500_30.snap
	deleted by us:   tests/snapshots/tests.contrib.django.test_django_snapshots.test_asgi_500_31.snap
	deleted by us:   tests/snapshots/tests.contrib.django.test_django_snapshots.test_asgi_500_3x.snap

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 refresh will re-evaluate the rules
  • @Mergifyio rebase will rebase this PR on its base branch
  • @Mergifyio update will merge the base branch into this PR
  • @Mergifyio backport <destination> will backport this PR on <destination> branch

Additionally, on Mergify dashboard you can:

  • look at your merge queues
  • generate the Mergify configuration with the config editor.

Finally, you can contact us on https://mergify.io/

* 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
@mergify mergify bot requested a review from a team as a code owner August 9, 2021 17:51
@mergify mergify bot added the conflicts label Aug 9, 2021
@mergify mergify bot mentioned this pull request Aug 9, 2021
@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (0.51@963d82e). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head 71ca68d differs from pull request most recent head 4a406ff. Consider uploading reports for the commit 4a406ff to get more accurate results
Impacted file tree graph

@@           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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 963d82e...4a406ff. Read the comment docs.

@mergify mergify bot merged commit 46e4b40 into 0.51 Aug 10, 2021
@mergify mergify bot deleted the mergify/bp/0.51/pr-2656 branch August 10, 2021 18:03
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.

4 participants