Skip to content

Commit a74aedd

Browse files
chore: change asgi request span finish (#14774)
## Description <!-- Provide an overview of the change and motivation for the change --> Removes manually finishing `request_span` and adds to `trace_handlers` to finish when context ends. An extension of: [chore(asgi): refactor websocket code to use core API](https://github.com/DataDog/dd-trace-py/pull/14345/files) ## Testing <!-- Describe your testing strategy or note what tests are included --> ## Risks <!-- Note any risks associated with this change, or "None" if no risks --> ## Additional Notes <!-- Any other information that would be helpful for reviewers --> --------- Co-authored-by: Brett Langdon <[email protected]>
1 parent 8b48e5b commit a74aedd

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

ddtrace/_trace/trace_handlers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,6 +1262,7 @@ def listen():
12621262
core.on(f"context.started.{context_name}", _start_span)
12631263

12641264
for name in (
1265+
"asgi.request",
12651266
"asgi.websocket.close.message",
12661267
"asgi.websocket.disconnect.message",
12671268
"asgi.websocket.receive.message",

ddtrace/contrib/internal/asgi/middleware.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,3 @@ def _handle_websocket_disconnect_message(
577577
tags={COMPONENT: self.integration_config.integration_name, SPAN_KIND: SpanKind.CONSUMER},
578578
) as ctx:
579579
core.dispatch("asgi.websocket.disconnect.message", (ctx, scope, message))
580-
581-
if request_span and request_span.error == 0:
582-
request_span.finish()

0 commit comments

Comments
 (0)