fix #4251: wrap BackgroundTasks in their own span (#4368)
* fix #4251: wrap BackgroundTasks in their own span Only the request/ASGI middleware was traced; background tasks were not. Background tasks ran after the response with no span, causing child spans to attach to a closed parent span. This change patches BackgroundTask.__call__ to wrap execution in a new span. Each background task now creates a child span of the request, ensuring a correct trace hierarchy. Add three regression tests for background task instrumentation. * Entry added to CHANGELOG.md linking to PR #4368 --------- Co-authored-by: Tammy Baylis <96076570+tammy-baylis-swi@users.noreply.github.com> Co-authored-by: Aaron Abbott <aaronabbott@google.com>
D
David Santos committed
915165bd44db72b30e2fda2d41a5124dedd27aa2
Parent: c41568f
Committed by GitHub <noreply@github.com>
on 5/8/2026, 9:03:57 PM