Skip to content

Commit a2a2007

Browse files
claudeconnortsui20
authored andcommitted
feat(btrblocks): add tracing entry span, drop stray zigzag debug
Instrument `BtrBlocksCompressor::compress` with a `#[tracing::instrument]` on the `vortex_compressor::cascade` target so downstream trace consumers (tracing-perfetto, tracing-opentelemetry) get a distinct BtrBlocks entry frame nested above the generic `CascadingCompressor::compress` pipeline span. Also delete the stray `tracing::debug!("zigzag output: {}", ...)` line in `schemes/integer.rs` — it predates the centralized `scheme.compress_result` event and is now redundant. Add a short `# Observability` section to the crate docs pointing at `vortex_compressor`'s full reference, plus one recipe. Signed-off-by: Claude <noreply@anthropic.com>
1 parent f57278c commit a2a2007

4 files changed

Lines changed: 39 additions & 2 deletions

File tree

vortex-btrblocks/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ num-traits = { workspace = true }
2020
pco = { workspace = true, optional = true }
2121
rand = { workspace = true }
2222
rustc-hash = { workspace = true }
23-
tracing = { workspace = true }
23+
tracing = { workspace = true, features = ["std", "attributes"] }
2424
vortex-alp = { workspace = true }
2525
vortex-array = { workspace = true }
2626
vortex-buffer = { workspace = true }

vortex-btrblocks/src/canonical_compressor.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,24 @@ pub struct BtrBlocksCompressor(
3838

3939
impl BtrBlocksCompressor {
4040
/// Compresses an array using BtrBlocks-inspired compression.
41+
///
42+
/// This call is instrumented with a `vortex_compressor::cascade` span named
43+
/// `BtrBlocksCompressor::compress` so that downstream tracing consumers
44+
/// (e.g. `tracing-perfetto`) have a distinct entry frame to pivot on, nested
45+
/// above the generic [`CascadingCompressor::compress`] span that actually
46+
/// runs the pipeline. See the `Observability` section of the
47+
/// [`vortex_compressor`] crate docs for the full tracing reference.
48+
#[tracing::instrument(
49+
target = "vortex_compressor::cascade",
50+
name = "BtrBlocksCompressor::compress",
51+
level = "trace",
52+
skip_all,
53+
fields(
54+
len = array.len(),
55+
nbytes = array.nbytes(),
56+
dtype = %array.dtype(),
57+
),
58+
)]
4159
pub fn compress(&self, array: &ArrayRef) -> VortexResult<ArrayRef> {
4260
self.0.compress(array)
4361
}

vortex-btrblocks/src/lib.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,23 @@
5252
//! .build();
5353
//! ```
5454
//!
55+
//! # Observability
56+
//!
57+
//! [`BtrBlocksCompressor`] participates in the [`vortex_compressor`] tracing target system.
58+
//! See the [`vortex_compressor` crate docs](vortex_compressor#observability) for the full
59+
//! reference on targets, spans, and events.
60+
//!
61+
//! The top-level [`BtrBlocksCompressor::compress`] call adds its own
62+
//! `vortex_compressor::cascade` span (named `BtrBlocksCompressor::compress`) that nests
63+
//! above the generic cascading-compressor pipeline, giving downstream trace consumers a
64+
//! distinct entry frame.
65+
//!
66+
//! Quick start — one line per leaf with scheme, estimated ratio, actual ratio, accepted?:
67+
//!
68+
//! ```text
69+
//! RUST_LOG=vortex_compressor::encode=debug cargo test -p vortex-btrblocks
70+
//! ```
71+
//!
5572
//! [BtrBlocks]: https://www.cs.cit.tum.de/fileadmin/w00cfj/dis/papers/btrblocks.pdf
5673
5774
mod builder;

vortex-btrblocks/src/schemes/integer.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,9 @@ impl Scheme for ZigZagScheme {
294294

295295
let compressed = compressor.compress_child(&encoded.into_array(), &ctx, self.id(), 0)?;
296296

297-
tracing::debug!("zigzag output: {}", compressed.encoding_id());
297+
// NOTE: scheme-level compression results are emitted centrally as the
298+
// `scheme.compress_result` event on the `vortex_compressor::encode`
299+
// target. See the `Observability` section of the `vortex_compressor` crate docs.
298300

299301
Ok(ZigZag::try_new(compressed)?.into_array())
300302
}

0 commit comments

Comments
 (0)