From 44cd1dcd9c1ab4234b341735ad675c37be414266 Mon Sep 17 00:00:00 2001 From: Michael Manganiello Date: Mon, 27 Sep 2021 23:37:56 -0300 Subject: [PATCH] Always detach token from request.META --- .../src/opentelemetry/instrumentation/django/middleware.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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