Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
adriangb committed Nov 15, 2024
1 parent 0b76908 commit 359d4e5
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,12 @@ def build_middleware_stack(self: Starlette) -> ASGIApp:

@staticmethod
def uninstrument_app(app: fastapi.FastAPI):
app.build_middleware_stack = app._original_build_middleware_stack
del app._original_build_middleware_stack
original_build_middleware_stack = getattr(
app, "_original_build_middleware_stack", None
)
if original_build_middleware_stack:
app.build_middleware_stack = original_build_middleware_stack
del app._original_build_middleware_stack
app.middleware_stack = app.build_middleware_stack()
app._is_instrumented_by_opentelemetry = False

Expand Down

0 comments on commit 359d4e5

Please sign in to comment.