diff --git a/instrumentation/opentelemetry-instrumentation-django/src/opentelemetry/instrumentation/django/middleware.py b/instrumentation/opentelemetry-instrumentation-django/src/opentelemetry/instrumentation/django/middleware.py index ebb664ba87..9e1ed2cb88 100644 --- a/instrumentation/opentelemetry-instrumentation-django/src/opentelemetry/instrumentation/django/middleware.py +++ b/instrumentation/opentelemetry-instrumentation-django/src/opentelemetry/instrumentation/django/middleware.py @@ -299,10 +299,7 @@ def process_response(self, request, response): activation.__exit__(None, None, None) if self._environ_token in request.META.keys(): - if is_asgi_request: - detach(request.META.get(self._environ_token)) - else: - detach(request.environ.get(self._environ_token)) + detach(request.META.get(self._environ_token)) request.META.pop(self._environ_token) return response