From f16067a7c51294e079b676032e10f4722cee067b Mon Sep 17 00:00:00 2001 From: Ed Page Date: Tue, 5 Mar 2024 12:08:51 -0600 Subject: [PATCH] fix(log): Trace parameters to align with profile This is a follow up to #13532 and prep for #13399 --- src/cargo/core/compiler/fingerprint/mod.rs | 5 ++++- src/cargo/core/global_cache_tracker.rs | 14 +++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/cargo/core/compiler/fingerprint/mod.rs b/src/cargo/core/compiler/fingerprint/mod.rs index 902b8072991..e3ac54a41d4 100644 --- a/src/cargo/core/compiler/fingerprint/mod.rs +++ b/src/cargo/core/compiler/fingerprint/mod.rs @@ -399,7 +399,10 @@ pub use dirty_reason::DirtyReason; /// transitively propagate throughout the dependency graph, it only forces this /// one unit which is very unlikely to be what you want unless you're /// exclusively talking about top-level units. -#[tracing::instrument(skip(build_runner, unit))] +#[tracing::instrument( + skip(build_runner, unit), + fields(package_id = %unit.pkg.package_id(), target = unit.target.name()) +)] pub fn prepare_target( build_runner: &mut BuildRunner<'_, '_>, unit: &Unit, diff --git a/src/cargo/core/global_cache_tracker.rs b/src/cargo/core/global_cache_tracker.rs index bc6198a8362..7d31dd00fec 100644 --- a/src/cargo/core/global_cache_tracker.rs +++ b/src/cargo/core/global_cache_tracker.rs @@ -697,7 +697,7 @@ impl GlobalCacheTracker { /// /// These orphaned files will be added to `delete_paths` so that the /// caller can delete them. - #[tracing::instrument(skip_all)] + #[tracing::instrument(skip(conn, gctx, base, delete_paths))] fn sync_db_with_files( conn: &Connection, now: Timestamp, @@ -797,7 +797,7 @@ impl GlobalCacheTracker { } /// For parent tables, add any entries that are on disk but aren't tracked in the db. - #[tracing::instrument(skip_all)] + #[tracing::instrument(skip(conn, now, base_path))] fn update_parent_for_missing_from_db( conn: &Connection, now: Timestamp, @@ -825,7 +825,7 @@ impl GlobalCacheTracker { /// /// This could happen for example if the user manually deleted the file or /// any such scenario where the filesystem and db are out of sync. - #[tracing::instrument(skip_all)] + #[tracing::instrument(skip(conn, base_path))] fn update_db_for_removed( conn: &Connection, parent_table_name: &str, @@ -855,7 +855,7 @@ impl GlobalCacheTracker { } /// Removes database entries for any files that are not on disk for the parent tables. - #[tracing::instrument(skip_all)] + #[tracing::instrument(skip(conn, base_path, child_base_paths, delete_paths))] fn update_db_parent_for_removed_from_disk( conn: &Connection, parent_table_name: &str, @@ -893,7 +893,7 @@ impl GlobalCacheTracker { /// Updates the database to add any `.crate` files that are currently /// not tracked (such as when they are downloaded by an older version of /// cargo). - #[tracing::instrument(skip_all)] + #[tracing::instrument(skip(conn, now, base_path))] fn populate_untracked_crate( conn: &Connection, now: Timestamp, @@ -928,7 +928,7 @@ impl GlobalCacheTracker { /// Updates the database to add any files that are currently not tracked /// (such as when they are downloaded by an older version of cargo). - #[tracing::instrument(skip_all)] + #[tracing::instrument(skip(conn, now, gctx, base_path, populate_size))] fn populate_untracked( conn: &Connection, now: Timestamp, @@ -994,7 +994,7 @@ impl GlobalCacheTracker { /// size. /// /// `update_db_for_removed` should be called before this is called. - #[tracing::instrument(skip_all)] + #[tracing::instrument(skip(conn, gctx, base_path))] fn update_null_sizes( conn: &Connection, gctx: &GlobalContext,