diff --git a/rust/lance/src/dataset.rs b/rust/lance/src/dataset.rs index 0b83a7c767e..48f755d668b 100644 --- a/rust/lance/src/dataset.rs +++ b/rust/lance/src/dataset.rs @@ -641,6 +641,7 @@ impl Dataset { /// # Returns /// /// * `RemovalStats` - Statistics about the removal operation + #[instrument(level = "debug", skip(self))] pub fn cleanup_old_versions( &self, older_than: Duration, diff --git a/rust/lance/src/dataset/cleanup.rs b/rust/lance/src/dataset/cleanup.rs index f1bf6727c5b..8bad6eb634f 100644 --- a/rust/lance/src/dataset/cleanup.rs +++ b/rust/lance/src/dataset/cleanup.rs @@ -55,7 +55,7 @@ use std::{ future, sync::{Mutex, MutexGuard}, }; -use tracing::info; +use tracing::{info, instrument, Span}; use crate::{utils::temporal::utc_now, Dataset}; @@ -150,6 +150,7 @@ impl<'a> CleanupTask<'a> { self.delete_unreferenced_files(inspection).await } + #[instrument(level = "debug", skip_all)] async fn process_manifests( &'a self, tagged_versions: &HashSet, @@ -246,6 +247,7 @@ impl<'a> CleanupTask<'a> { Ok(()) } + #[instrument(level = "debug", skip_all, fields(old_versions = inspection.old_manifests.len(), bytes_removed = tracing::field::Empty))] async fn delete_unreferenced_files( &self, inspection: CleanupInspection, @@ -306,6 +308,10 @@ impl<'a> CleanupTask<'a> { let mut removal_stats = removal_stats.into_inner().unwrap(); removal_stats.old_versions = num_old_manifests as u64; removal_stats.bytes_removed += manifest_bytes_removed?; + + let span = Span::current(); + span.record("bytes_removed", removal_stats.bytes_removed); + Ok(removal_stats) }