Skip to content

Commit 1f3206f

Browse files
authored
Make sure all tokio runtime propegate observability in the same way (#7193)
## Summary Just fixing custom-labels or any other tracing propagation through our tokio runtime types, which stopped working at some point. Signed-off-by: Adam Gutglick <adam@spiraldb.com>
1 parent b524763 commit 1f3206f

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

vortex-io/src/runtime/tokio.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -95,23 +95,15 @@ struct CurrentTokioRuntime;
9595

9696
impl Executor for CurrentTokioRuntime {
9797
fn spawn(&self, fut: BoxFuture<'static, ()>) -> AbortHandleRef {
98-
Box::new(tokio::runtime::Handle::current().spawn(fut).abort_handle())
98+
Executor::spawn(&tokio::runtime::Handle::current(), fut)
9999
}
100100

101101
fn spawn_cpu(&self, cpu: Box<dyn FnOnce() + Send + 'static>) -> AbortHandleRef {
102-
Box::new(
103-
tokio::runtime::Handle::current()
104-
.spawn(async move { cpu() })
105-
.abort_handle(),
106-
)
102+
Executor::spawn_cpu(&tokio::runtime::Handle::current(), cpu)
107103
}
108104

109105
fn spawn_blocking_io(&self, task: Box<dyn FnOnce() + Send + 'static>) -> AbortHandleRef {
110-
Box::new(
111-
tokio::runtime::Handle::current()
112-
.spawn_blocking(task)
113-
.abort_handle(),
114-
)
106+
Executor::spawn_blocking_io(&tokio::runtime::Handle::current(), task)
115107
}
116108
}
117109

@@ -159,13 +151,11 @@ impl BlockingRuntime for TokioRuntime {
159151
}
160152
}
161153

162-
#[cfg(feature = "tokio")]
163154
pub struct TokioBlockingIterator<'a, T> {
164155
handle: Arc<tokio::runtime::Handle>,
165156
stream: futures::stream::BoxStream<'a, T>,
166157
}
167158

168-
#[cfg(feature = "tokio")]
169159
impl<T> Iterator for TokioBlockingIterator<'_, T> {
170160
type Item = T;
171161

0 commit comments

Comments
 (0)