Skip to content

Django ASGI based async views do not create Transactions #3142

Description

@antonpirker

If there is an async view in Django then a transaction should be created for that view.

It seems that this is not the case right now: https://github.com/getsentry/sentry-python/blob/antonpirker/trace-origin-in-integrations/tests/integrations/django/asgi/test_asgi.py#L340

The view triggered in the linked test above should create a transaction.

There was a change in Django that we missed: #3141

We need to make sure that async views in Django emit transactions:

  • when run with Django channels (channels.http.AsgiHandler is monkey patched to start transactions)
  • when running with Djangos own ASGI handler (django.core.handlers.asgi.ASGIHandler only available in Django 3.0+)

Make sure this works in old Django (<3.0) and also newer Djangos. When checking newer Djangos make sure it works when using Channels or Djangos built in ASGI handler.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions