Skip to content

Commit d37444a

Browse files
authored
fix[vortex-{scan,io,datafusion}]: propagate tracing spans (#4939)
This change correctly connects object storage spans with the expected parent spans. Previously, object store spans were orphaned. Signed-off-by: Alfonso Subiotto Marques <alfonso.subiotto@polarsignals.com>
1 parent 5694288 commit d37444a

File tree

6 files changed

+13
-4
lines changed

6 files changed

+13
-4
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vortex-datafusion/src/persistent/opener.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use datafusion_pruning::FilePruner;
1919
use futures::{FutureExt, StreamExt, TryStreamExt, stream};
2020
use object_store::ObjectStore;
2121
use object_store::path::Path;
22+
use tracing::Instrument;
2223
use vortex::dtype::FieldName;
2324
use vortex::error::VortexError;
2425
use vortex::expr::{root, select};
@@ -266,6 +267,7 @@ impl FileOpener for VortexOpener {
266267

267268
Ok(stream)
268269
}
270+
.in_current_span()
269271
.boxed())
270272
}
271273
}

vortex-io/src/file/object_store.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use async_compat::Compat;
99
use futures::future::BoxFuture;
1010
use futures::stream::BoxStream;
1111
use futures::{FutureExt, StreamExt};
12+
use tracing::Instrument;
1213
use vortex_buffer::ByteBufferMut;
1314
use vortex_error::{VortexError, VortexResult};
1415

@@ -145,7 +146,8 @@ impl ReadSource for ObjectStoreIoSource {
145146
};
146147

147148
Ok(buffer.freeze())
148-
};
149+
}
150+
.in_current_span();
149151

150152
async move { req.resolve(Compat::new(read).await) }
151153
})

vortex-io/src/runtime/smol.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

44
use futures::future::BoxFuture;
5+
use tracing::Instrument;
56

67
use crate::runtime::{AbortHandle, AbortHandleRef, Executor, IoTask};
78

@@ -22,7 +23,7 @@ impl Executor for smol::Executor<'static> {
2223
}
2324

2425
fn spawn_io(&self, task: IoTask) {
25-
smol::Executor::spawn(self, task.source.drive_send(task.stream)).detach()
26+
smol::Executor::spawn(self, task.source.drive_send(task.stream).in_current_span()).detach()
2627
}
2728
}
2829

vortex-io/src/runtime/tokio.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
use std::sync::{Arc, LazyLock};
55

66
use futures::future::BoxFuture;
7+
use tracing::Instrument;
78

89
use crate::runtime::{AbortHandle, AbortHandleRef, BlockingRuntime, Executor, Handle, IoTask};
910

@@ -46,7 +47,7 @@ impl Executor for tokio::runtime::Handle {
4647
}
4748

4849
fn spawn_io(&self, task: IoTask) {
49-
tokio::runtime::Handle::spawn(self, task.source.drive_send(task.stream));
50+
tokio::runtime::Handle::spawn(self, task.source.drive_send(task.stream).in_current_span());
5051
}
5152
}
5253

@@ -75,7 +76,8 @@ impl Executor for CurrentTokioRuntime {
7576
}
7677

7778
fn spawn_io(&self, task: IoTask) {
78-
tokio::runtime::Handle::current().spawn(task.source.drive_send(task.stream));
79+
tokio::runtime::Handle::current()
80+
.spawn(task.source.drive_send(task.stream).in_current_span());
7981
}
8082
}
8183

vortex-scan/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ parking_lot = { workspace = true }
3939
roaring = { workspace = true, optional = true }
4040
sketches-ddsketch = { workspace = true }
4141
tokio = { workspace = true, features = ["rt-multi-thread"], optional = true }
42+
tracing = { workspace = true }
4243

4344
[dev-dependencies]
4445
loom = { workspace = true }

0 commit comments

Comments
 (0)