-
Notifications
You must be signed in to change notification settings - Fork 633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Django ASGI not supported #165
Comments
The same error |
Still a WIP, this diff adds `asgi` as an extra, and uses its methods if the current request is an `ASGIRequest`. I still need to dig deeper in the current test suite, to find a way to duplicate the tests in `instrumentation/opentelemetry-instrumentation-django/tests/test_middleware.py`, but using an [`AsyncClient`](https://docs.djangoproject.com/en/3.1/topics/testing/tools/#testing-asynchronous-code). Fixes open-telemetry#165, open-telemetry#185, open-telemetry#280, open-telemetry#334.
Still a WIP, this diff adds `asgi` as an extra, and uses its methods if the current request is an `ASGIRequest`. I still need to dig deeper in the current test suite, to find a way to duplicate the tests in `instrumentation/opentelemetry-instrumentation-django/tests/test_middleware.py`, but using an [`AsyncClient`](https://docs.djangoproject.com/en/3.1/topics/testing/tools/#testing-asynchronous-code). Fixes open-telemetry#165, open-telemetry#185, open-telemetry#280, open-telemetry#334.
This issue was marked stale due to lack of activity. It will be closed in 30 days. |
Still a WIP, this diff adds `asgi` as an extra, and uses its methods if the current request is an `ASGIRequest`. I still need to dig deeper in the current test suite, to find a way to duplicate the tests in `instrumentation/opentelemetry-instrumentation-django/tests/test_middleware.py`, but using an [`AsyncClient`](https://docs.djangoproject.com/en/3.1/topics/testing/tools/#testing-asynchronous-code). Fixes open-telemetry#165, open-telemetry#185, open-telemetry#280, open-telemetry#334.
Still a WIP, this diff adds `asgi` as an extra, and uses its methods if the current request is an `ASGIRequest`. I still need to dig deeper in the current test suite, to find a way to duplicate the tests in `instrumentation/opentelemetry-instrumentation-django/tests/test_middleware.py`, but using an [`AsyncClient`](https://docs.djangoproject.com/en/3.1/topics/testing/tools/#testing-asynchronous-code). Fixes open-telemetry#165, open-telemetry#185, open-telemetry#280, open-telemetry#334.
This diff adds `asgi` as an extra, and uses its methods if the current request is an `ASGIRequest`. I still need to dig deeper in the current test suite, to find a way to duplicate the tests in `instrumentation/opentelemetry-instrumentation-django/tests/test_middleware.py`, but using an [`AsyncClient`](https://docs.djangoproject.com/en/3.1/topics/testing/tools/#testing-asynchronous-code). Fixes open-telemetry#165, open-telemetry#185, open-telemetry#280, open-telemetry#334.
Closed as inactive. Feel free to reopen if this issue needs resolving. |
This diff adds `asgi` as an extra, and uses its methods if the current request is an `ASGIRequest`. I still need to dig deeper in the current test suite, to find a way to duplicate the tests in `instrumentation/opentelemetry-instrumentation-django/tests/test_middleware.py`, but using an [`AsyncClient`](https://docs.djangoproject.com/en/3.1/topics/testing/tools/#testing-asynchronous-code). Fixes open-telemetry#165, open-telemetry#185, open-telemetry#280, open-telemetry#334.
This diff adds `asgi` as an extra, and uses its methods if the current request is an `ASGIRequest`. I still need to dig deeper in the current test suite, to find a way to duplicate the tests in `instrumentation/opentelemetry-instrumentation-django/tests/test_middleware.py`, but using an [`AsyncClient`](https://docs.djangoproject.com/en/3.1/topics/testing/tools/#testing-asynchronous-code). Fixes open-telemetry#165, open-telemetry#185, open-telemetry#280, open-telemetry#334.
This diff adds `asgi` as an extra, and uses its methods if the current request is an `ASGIRequest`. I still need to dig deeper in the current test suite, to find a way to duplicate the tests in `instrumentation/opentelemetry-instrumentation-django/tests/test_middleware.py`, but using an [`AsyncClient`](https://docs.djangoproject.com/en/3.1/topics/testing/tools/#testing-asynchronous-code). Fixes open-telemetry#165, open-telemetry#185, open-telemetry#280, open-telemetry#334.
This diff adds `asgi` as an extra, and uses its methods if the current request is an `ASGIRequest`. I still need to dig deeper in the current test suite, to find a way to duplicate the tests in `instrumentation/opentelemetry-instrumentation-django/tests/test_middleware.py`, but using an [`AsyncClient`](https://docs.djangoproject.com/en/3.1/topics/testing/tools/#testing-asynchronous-code). Fixes open-telemetry#165, open-telemetry#185, open-telemetry#280, open-telemetry#334.
@HiveTraum @vladimirmyshkovski, as this issue was automatically closed, I'm pinging you to let you know that Django ASGI support has been added in #391, and released in version |
Still have same problem.
|
@fynjah, do you have an application example I can use to test why it fails? Or, at least, which Python/Django versions are being installed, and how the project is instrumented and executed? |
@adamantike Unfortunately I don't have example app:/ I will try to repeat this issue on example project asap. |
I had a similar issue: had opentelemetry-instrumentation-django installed with asgi extras, but still received an error
Since otel was added to an existing application using django 4 and django-channels 3, it wasn't immediate to find the cause of this, but in the end it was due to misconfiguration of the routing, which did not handle http requests with asgi. Documentation for asgi and django/websocket is still missing though. |
@akiross Can you elaborate on what you did to resolve this? |
@pilhuhn sure, I didn't add details since I wasn't sure this might be useful in other situations, but in our
HIH |
Describe your environment
Python 3.8
Docker(python:3.8 image)
daphne-2.5.0/uvicorn 0.11.8/hypercorn 0.10.2
Django-3.1.0
Steps to reproduce
git clone https://github.com/HiveTraum/opentelemetry-django-asgi-example cd opentelemetry-django-asgi-example docker-compose up -d curl -I 127.0.0.1:8000/api/ curl -I 127.0.0.1:8001/api/ curl -I 127.0.0.1:8002/api/
What is the expected behavior?
Correct request processing
What is the actual behavior?
KeyError when trying to get
wsgi.url_scheme
from environAdditional context
Every wsgi server fill this variable inside request.META, but every asgi doesn't. Actually I don't know precisely to whom this bug can be addressed. For now opentelemetry-instrumentation-django relies on opentelemetry-instrumentation-wsgi, but ignores opentelemetry-instrumentation-asgi, maybe this can be key to solve this issue
The text was updated successfully, but these errors were encountered: