Skip to content

Commit 834c6b7

Browse files
committed
Update comment to clarify purpose of removing app from WeakSet
1 parent ea27204 commit 834c6b7

File tree

1 file changed

+2
-1
lines changed
  • instrumentation/opentelemetry-instrumentation-fastapi/src/opentelemetry/instrumentation/fastapi

1 file changed

+2
-1
lines changed

instrumentation/opentelemetry-instrumentation-fastapi/src/opentelemetry/instrumentation/fastapi/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,8 @@ def uninstrument_app(app: fastapi.FastAPI):
359359
app.middleware_stack = app.build_middleware_stack()
360360
app._is_instrumented_by_opentelemetry = False
361361

362-
# Remove the app from the set of instrumented apps to prevent memory leaks
362+
# Remove the app from the set of instrumented apps to avoid calling uninstrument twice
363+
# if the instrumentation is later disabled or such
363364
# Use discard to avoid KeyError if already GC'ed
364365
_InstrumentedFastAPI._instrumented_fastapi_apps.discard(app)
365366

0 commit comments

Comments
 (0)