diff --git a/dice/dice/src/impls/core/graph/storage.rs b/dice/dice/src/impls/core/graph/storage.rs index 28fc19abc910..8100203037f0 100644 --- a/dice/dice/src/impls/core/graph/storage.rs +++ b/dice/dice/src/impls/core/graph/storage.rs @@ -165,7 +165,7 @@ impl VersionedGraph { /// is only updated if the version of the new value is of a newer /// version than what is stored. /// Returns the new entry, and an optional old entry that was invalidated due to this update - #[instrument(level = "debug", skip(self, value, storage_type, deps, reusable), fields(key = ?key))] + #[cfg_attr(debug_assertions, instrument(level = "debug", skip(self, value, storage_type, deps, reusable), fields(key = ?key)))] pub(crate) fn update( &mut self, key: VersionedGraphKey, @@ -276,7 +276,7 @@ impl VersionedGraph { } } - #[instrument(level = "debug", skip(self, value, deps), fields(key = ?key, v = %v, first_dep_dirtied = ?first_dep_dirtied, latest_dep_verified = ?latest_dep_verified))] + #[cfg_attr(debug_assertions, instrument(level = "debug", skip(self, value, deps), fields(key = ?key, v = %v, first_dep_dirtied = ?first_dep_dirtied, latest_dep_verified = ?latest_dep_verified)))] fn update_empty( &mut self, key: DiceKey, @@ -305,7 +305,7 @@ impl VersionedGraph { } /// Returns the newly updated value for the key, and whether or not any state changed. - #[instrument(level = "debug", skip(self, value, deps, num_to_keep, reusable), fields(key = ?key, key_of_e = %key_of_e, first_dep_dirtied = ?first_dep_dirtied, latest_dep_verified = ?latest_dep_verified))] + #[cfg_attr(debug_assertions, instrument(level = "debug", skip(self, value, deps, num_to_keep, reusable), fields(key = ?key, key_of_e = %key_of_e, first_dep_dirtied = ?first_dep_dirtied, latest_dep_verified = ?latest_dep_verified)))] fn update_entry( &mut self, key_of_e: VersionNumber, diff --git a/dice/dice/src/impls/core/processor.rs b/dice/dice/src/impls/core/processor.rs index 2e3927257c1e..73fe05ebb3f1 100644 --- a/dice/dice/src/impls/core/processor.rs +++ b/dice/dice/src/impls/core/processor.rs @@ -48,7 +48,7 @@ impl StateProcessor { debug!("Processor terminated"); } - #[instrument(skip_all, fields(kind = %message.variant_name()))] + #[cfg_attr(debug_assertions, instrument(skip_all, fields(kind = %message.variant_name())))] fn iteration(&mut self, message: StateRequest) { match message { StateRequest::UpdateState { changes, resp } => { diff --git a/dice/dice/src/impls/incremental/mod.rs b/dice/dice/src/impls/incremental/mod.rs index a7ace7907abe..f0f70ccd45b2 100644 --- a/dice/dice/src/impls/incremental/mod.rs +++ b/dice/dice/src/impls/incremental/mod.rs @@ -103,11 +103,11 @@ impl IncrementalEngine { ) } - #[instrument( + #[cfg_attr(debug_assertions, instrument( level = "debug", skip(state, promise, eval, event_dispatcher), fields(k = ?k, version = %v), - )] + ))] pub(crate) fn project_for_key( state: CoreStateHandle, promise: DicePromise, @@ -289,11 +289,11 @@ impl IncrementalEngine { /// determines if the given 'Dependency' has changed between versions 'last_version' and /// 'target_version' - #[instrument( + #[cfg_attr(debug_assertions, instrument( level = "debug", skip(self, eval, deps, check_deps_state), fields(version = %eval.per_live_version_ctx.get_version(), verified_versions = %verified_versions) - )] + ))] async fn compute_whether_dependencies_changed( &self, parent_key: ParentKey, diff --git a/dice/dice/src/legacy/incremental/dep_trackers.rs b/dice/dice/src/legacy/incremental/dep_trackers.rs index 4caedbc29df7..04e6775f6273 100644 --- a/dice/dice/src/legacy/incremental/dep_trackers.rs +++ b/dice/dice/src/legacy/incremental/dep_trackers.rs @@ -277,7 +277,7 @@ mod internals { where K: IncrementalComputeProperties, { - #[instrument(level = "info", skip(self, transaction_ctx, extra), fields(k = %self.k, version = %transaction_ctx.get_version()))] + #[cfg_attr(debug_assertions, instrument(level = "info", skip(self, transaction_ctx, extra), fields(k = %self.k, version = %transaction_ctx.get_version())))] async fn recompute( &self, transaction_ctx: &Arc, diff --git a/dice/dice/src/legacy/incremental/mod.rs b/dice/dice/src/legacy/incremental/mod.rs index 9aa30181b287..1479b05b2198 100644 --- a/dice/dice/src/legacy/incremental/mod.rs +++ b/dice/dice/src/legacy/incremental/mod.rs @@ -179,7 +179,7 @@ where } /// Dirties the value at K - #[instrument(level = "info", skip(self), fields(k = %k, version = %version))] + #[cfg_attr(debug_assertions, instrument(level = "info", skip(self), fields(k = %k, version = %version)))] pub(crate) fn dirty(&self, k: K::Key, version: VersionNumber, force_dirty: bool) { // It is crucial that we dirty first before updating the rdeps. // This is related to the race condition where we invalidate while nodes are being inserted @@ -269,7 +269,7 @@ where } /// Updates the value at K. Returns whether this injected value actually causes a change - #[instrument(level = "info", skip(self, res, ), fields(k = %k, version = %version))] + #[cfg_attr(debug_assertions, instrument(level = "info", skip(self, res, ), fields(k = %k, version = %version)))] pub(crate) fn update_injected_value( self: &Arc, k: K::Key, @@ -355,11 +355,11 @@ where } } - #[instrument( + #[cfg_attr(debug_assertions, instrument( level = "debug", skip(self, transaction_ctx, extra, cancelled_instance), fields(k = %k), - )] + ))] fn new_dice_task( self: Arc>, k: K::Key, @@ -539,11 +539,11 @@ where (task, fut) } - #[instrument( + #[cfg_attr(debug_assertions, instrument( level = "debug", skip(self, transaction_ctx, extra, cancellation), fields(k = %k, version = %transaction_ctx.get_version()), - )] + ))] async fn compute( self: &Arc, k: &K::Key, @@ -630,11 +630,11 @@ impl IncrementalEngine> { } /// Synchronously evaluate projection key without recording dependencies. - #[instrument( + #[cfg_attr(debug_assertions, instrument( level = "debug", skip(self, transaction_ctx, extra, derive_from), fields(k = %k, v = %transaction_ctx.get_version()), - )] + ))] fn eval_projection_versioned( self: &Arc, k: &ProjectionKeyAsKey

,