From f159109d56107c5790d11770ce63270fa52ccc78 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 29 May 2026 16:44:35 +0000 Subject: [PATCH 1/2] bench: quiet Lance INFO logs by default in random access bench Lance crates emit chatty INFO-level logs (dataset open/commit details, fragment reads) that drown out benchmark output in CI. Default the lance crate family to WARN in the shared bench logging filter unless the user opts in via --verbose or RUST_LOG. Signed-off-by: Joe Isaacs --- vortex-bench/src/utils/logging.rs | 35 +++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/vortex-bench/src/utils/logging.rs b/vortex-bench/src/utils/logging.rs index b414184f930..cf7c96d88cd 100644 --- a/vortex-bench/src/utils/logging.rs +++ b/vortex-bench/src/utils/logging.rs @@ -81,6 +81,23 @@ pub fn setup_logging_and_tracing_with_format( Ok(()) } +/// Lance crates emit chatty `INFO`-level logs (dataset open/commit details, fragment reads, etc.) +/// that drown out benchmark output. We quiet the whole `lance` crate family to `WARN` by default. +/// Targets are module paths, so hyphenated crate names appear with underscores. +const QUIET_LANCE_TARGETS: &[&str] = &[ + "lance", + "lance_arrow", + "lance_core", + "lance_datafusion", + "lance_datagen", + "lance_encoding", + "lance_file", + "lance_index", + "lance_io", + "lance_linalg", + "lance_table", +]; + pub fn default_env_filter(is_verbose: bool) -> EnvFilter { match EnvFilter::try_from_default_env() { Ok(filter) => filter, @@ -91,9 +108,23 @@ pub fn default_env_filter(is_verbose: bool) -> EnvFilter { LevelFilter::INFO }; - EnvFilter::builder() + let mut filter = EnvFilter::builder() .with_default_directive(default_level.into()) - .from_env_lossy() + .from_env_lossy(); + + // Only silence Lance when the user has not explicitly opted into verbose output; + // `--verbose` (or `RUST_LOG`) should still surface everything. + if !is_verbose { + for target in QUIET_LANCE_TARGETS { + filter = filter.add_directive( + format!("{target}=warn") + .parse() + .expect("hardcoded lance log directive is valid"), + ); + } + } + + filter } } } From 0e1d74b905e6aef692bf400e847c536e4c2b6491 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 29 May 2026 17:04:27 +0000 Subject: [PATCH 2/2] bench: suppress Lance INFO logs via a target predicate Replace the hardcoded list of lance crate names with a single predicate filter that drops any event from the lance crate family below WARN. This covers every current and future lance_* crate without enumeration. The suppression only kicks in when neither --verbose nor RUST_LOG is set, so explicit opt-in still surfaces everything. Signed-off-by: Joe Isaacs --- vortex-bench/src/utils/logging.rs | 85 +++++++++++++++++++------------ 1 file changed, 52 insertions(+), 33 deletions(-) diff --git a/vortex-bench/src/utils/logging.rs b/vortex-bench/src/utils/logging.rs index cf7c96d88cd..ea13fc825d0 100644 --- a/vortex-bench/src/utils/logging.rs +++ b/vortex-bench/src/utils/logging.rs @@ -5,10 +5,12 @@ use std::fs::File; use std::io::IsTerminal; use clap::ValueEnum; +use tracing::Level; use tracing::level_filters::LevelFilter; use tracing_perfetto::PerfettoLayer; use tracing_subscriber::EnvFilter; use tracing_subscriber::Layer; +use tracing_subscriber::filter::filter_fn; use tracing_subscriber::prelude::*; /// Format for the primary stderr log sink. @@ -46,6 +48,14 @@ pub fn setup_logging_and_tracing_with_format( ) -> anyhow::Result<()> { let filter = default_env_filter(verbose); + // Lance crates emit chatty INFO-level logs (dataset open/commit details, fragment reads, ...) + // that drown out benchmark output. Drop everything below WARN from the `lance` family unless + // the user opts in via `--verbose` or `RUST_LOG`. + let suppress_lance = !verbose && std::env::var(EnvFilter::DEFAULT_ENV).is_err(); + let lance_filter = filter_fn(move |meta| { + !(suppress_lance && *meta.level() > Level::WARN && is_lance_target(meta.target())) + }); + let perfetto_layer = perfetto .then(|| { Ok::<_, anyhow::Error>( @@ -74,6 +84,7 @@ pub fn setup_logging_and_tracing_with_format( tracing_subscriber::registry() .with(filter) + .with(lance_filter) .with(perfetto_layer) .with(fmt_layer) .init(); @@ -81,23 +92,6 @@ pub fn setup_logging_and_tracing_with_format( Ok(()) } -/// Lance crates emit chatty `INFO`-level logs (dataset open/commit details, fragment reads, etc.) -/// that drown out benchmark output. We quiet the whole `lance` crate family to `WARN` by default. -/// Targets are module paths, so hyphenated crate names appear with underscores. -const QUIET_LANCE_TARGETS: &[&str] = &[ - "lance", - "lance_arrow", - "lance_core", - "lance_datafusion", - "lance_datagen", - "lance_encoding", - "lance_file", - "lance_index", - "lance_io", - "lance_linalg", - "lance_table", -]; - pub fn default_env_filter(is_verbose: bool) -> EnvFilter { match EnvFilter::try_from_default_env() { Ok(filter) => filter, @@ -108,23 +102,48 @@ pub fn default_env_filter(is_verbose: bool) -> EnvFilter { LevelFilter::INFO }; - let mut filter = EnvFilter::builder() + EnvFilter::builder() .with_default_directive(default_level.into()) - .from_env_lossy(); - - // Only silence Lance when the user has not explicitly opted into verbose output; - // `--verbose` (or `RUST_LOG`) should still surface everything. - if !is_verbose { - for target in QUIET_LANCE_TARGETS { - filter = filter.add_directive( - format!("{target}=warn") - .parse() - .expect("hardcoded lance log directive is valid"), - ); - } - } - - filter + .from_env_lossy() + } + } +} + +/// True for log targets emitted by any crate in the `lance` family (`lance`, `lance_core`, +/// `lance_io`, ...). Targets are module paths, so the crate name is the leading path segment. +fn is_lance_target(target: &str) -> bool { + target == "lance" || target.starts_with("lance::") || target.starts_with("lance_") +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn lance_targets_match_the_crate_family() { + for target in [ + "lance", + "lance::dataset", + "lance_core::utils", + "lance_io", + "lance_encoding::decoder", + ] { + assert!(is_lance_target(target), "expected match for {target}"); + } + for target in ["lancelot", "vortex_array", "datafusion", "arrow::array"] { + assert!(!is_lance_target(target), "unexpected match for {target}"); + } + } + + #[test] + fn level_ordering_drops_only_below_warn() { + // The suppression predicate keeps an event when its level is *not* greater than WARN. + // Guard against the `tracing::Level` ordering inverting underneath us. + for level in [Level::WARN, Level::ERROR] { + assert!(level <= Level::WARN, "{level} should be kept"); + } + for level in [Level::INFO, Level::DEBUG, Level::TRACE] { + assert!(level > Level::WARN, "{level} should be dropped"); } } }