diff --git a/instrumentation/opentelemetry-instrumentation-django/src/opentelemetry/instrumentation/django/middleware/otel_middleware.py b/instrumentation/opentelemetry-instrumentation-django/src/opentelemetry/instrumentation/django/middleware/otel_middleware.py index 224a046bfa..0e274b5c1d 100644 --- a/instrumentation/opentelemetry-instrumentation-django/src/opentelemetry/instrumentation/django/middleware/otel_middleware.py +++ b/instrumentation/opentelemetry-instrumentation-django/src/opentelemetry/instrumentation/django/middleware/otel_middleware.py @@ -337,8 +337,6 @@ def process_response(self, request, response): ) request_start_time = request.META.pop(self._environ_timer_key, None) - response_hook_exception = None - if activation and span: if is_asgi_request: set_status_code(span, response.status_code) @@ -407,7 +405,4 @@ def process_response(self, request, response): detach(request.META.get(self._environ_token)) request.META.pop(self._environ_token) - if response_hook_exception is not None: - raise response_hook_exception - return response