Skip to content

Commit 217763b

Browse files
committed
rectify comment/explanation on inner middleware for exception handling
1 parent 3cc31d0 commit 217763b

File tree

1 file changed

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

1 file changed

+2
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,8 @@ def build_middleware_stack(self: Starlette) -> ASGIApp:
330330
# Define an additional middleware for exception handling that gets
331331
# added as a regular user middleware.
332332
# Normally, `opentelemetry.trace.use_span` covers the recording of
333-
# exceptions into the active span, but because of order of
334-
# middleware execution, that doesn't work so we have to do it in an
335-
# inner middleware.
333+
# exceptions into the active span, but `OpenTelemetryMiddleware`
334+
# ends the span too early before the excepetion can be recorded.
336335
class ExceptionHandlerMiddleware:
337336
def __init__(self, app):
338337
self.app = app

0 commit comments

Comments
 (0)