Skip to content

Commit

Permalink
Add changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
Kludex committed Nov 26, 2024
1 parent c88ac3f commit 12f2017
Showing 1 changed file with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit 12f2017

Please sign in to comment.