From 12f201774c63b720749c9f901ce5feac21dacb2a Mon Sep 17 00:00:00 2001 From: Marcelo Trylesinski Date: Tue, 26 Nov 2024 08:07:49 +0100 Subject: [PATCH] Add changelog --- .../instrumentation/starlette/__init__.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/instrumentation/opentelemetry-instrumentation-starlette/src/opentelemetry/instrumentation/starlette/__init__.py b/instrumentation/opentelemetry-instrumentation-starlette/src/opentelemetry/instrumentation/starlette/__init__.py index ca940f748c..befe166e59 100644 --- a/instrumentation/opentelemetry-instrumentation-starlette/src/opentelemetry/instrumentation/starlette/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-starlette/src/opentelemetry/instrumentation/starlette/__init__.py @@ -256,7 +256,11 @@ def instrument_app( @staticmethod def uninstrument_app(app: applications.Starlette): - app.user_middleware = [x for x in app.user_middleware if x.cls is not OpenTelemetryMiddleware] + app.user_middleware = [ + x + for x in app.user_middleware + if x.cls is not OpenTelemetryMiddleware + ] app.middleware_stack = app.build_middleware_stack() app._is_instrumented_by_opentelemetry = False @@ -266,9 +270,15 @@ def instrumentation_dependencies(self) -> Collection[str]: def _instrument(self, **kwargs: Unpack[InstrumentKwargs]): self._original_starlette = applications.Starlette _InstrumentedStarlette._tracer_provider = kwargs.get("tracer_provider") - _InstrumentedStarlette._server_request_hook = kwargs.get("server_request_hook") - _InstrumentedStarlette._client_request_hook = kwargs.get("client_request_hook") - _InstrumentedStarlette._client_response_hook = kwargs.get("client_response_hook") + _InstrumentedStarlette._server_request_hook = kwargs.get( + "server_request_hook" + ) + _InstrumentedStarlette._client_request_hook = kwargs.get( + "client_request_hook" + ) + _InstrumentedStarlette._client_response_hook = kwargs.get( + "client_response_hook" + ) _InstrumentedStarlette._meter_provider = kwargs.get("_meter_provider") applications.Starlette = _InstrumentedStarlette