open-telemetry / open-telemetry/opentelemetry-python-contrib
Django instrumentation assumes ASGI is only for Django3+
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 1.1k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 16
Description
Describe your environment
My code is on Django 2.x. And I run into https://github.com/open-telemetry/opentelemetry-python/issues/2833
Debugging down shows that the _is_asgi_request() in otel_middleware.py is thus determining that a request can't be an ASGI request.
Steps to reproduce
Just look at the code. Also when you continue and set is_asgi_request to True manually, my code works as expected
What is the expected behavior?
Just use ASGi and don't run into #2833
What is the actual behavior?
Run into #2833 as even valid ASGi requests are treated like WSGi ones, which then fails.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in otel_middleware.py at _is_asgi_request() and compare its Django-version assumption with the Django 2.x environment described. Reproduce the behavior from the issue and verify that valid ASGI requests are treated as ASGI rather than WSGI, avoiding the failure in issue #2833.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100