Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions ddtrace/contrib/internal/asgi/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,16 +457,18 @@ async def wrapped_blocked_send(message: Mapping[str, Any]):
except BlockingException as e:
set_blocked(e.args[0])
return await _blocked_asgi_app(scope, receive, wrapped_blocked_send)
except Exception as exc:
(exc_type, exc_val, exc_tb) = sys.exc_info()
span.set_exc_info(exc_type, exc_val, exc_tb)
self.handle_exception_span(exc, span)
raise
except BaseException as exception:
# managing python 3.11+ BaseExceptionGroup with compatible code for 3.10 and below
# Check for BlockingException in BaseExceptionGroup (Python 3.11+)
if exc := find_exception(exception, BlockingException):
set_blocked(exc.args[0])
return await _blocked_asgi_app(scope, receive, wrapped_blocked_send)

# Log regular exceptions
if isinstance(exception, Exception):
(exc_type, exc_val, exc_tb) = sys.exc_info()
span.set_exc_info(exc_type, exc_val, exc_tb)
self.handle_exception_span(exception, span)

raise
finally:
core.dispatch("web.request.final_tags", (span,))
Expand Down
Loading