Skip to content

Commit

Permalink
Fix tracing instrumentation across spawn_blocking() calls (#7878)
Browse files Browse the repository at this point in the history
  • Loading branch information
Turbo87 authored Jan 5, 2024
1 parent 5acd277 commit 7ad03f8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ where
R: Send + 'static,
E: Send + From<JoinError> + 'static,
{
let current_span = tracing::Span::current();
let hub = Hub::current();
tokio::task::spawn_blocking(move || Hub::run(hub, f))
tokio::task::spawn_blocking(move || current_span.in_scope(|| Hub::run(hub, f)))
.await
// Convert `JoinError` to `E`
.map_err(Into::into)
Expand Down

0 comments on commit 7ad03f8

Please sign in to comment.