From ab869586f598c7c250d4bb21dcafe999256cc550 Mon Sep 17 00:00:00 2001 From: Akhilesh Singhania Date: Wed, 13 Mar 2024 12:41:36 +0100 Subject: [PATCH] Improve some tracing spans (#10774) Add a span and improve the naming of another --------- Co-authored-by: Simonas Kazlauskas --- runtime/near-vm-runner/src/near_vm_runner.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/runtime/near-vm-runner/src/near_vm_runner.rs b/runtime/near-vm-runner/src/near_vm_runner.rs index 501679f81b0..f8f45c6e7d1 100644 --- a/runtime/near-vm-runner/src/near_vm_runner.rs +++ b/runtime/near-vm-runner/src/near_vm_runner.rs @@ -353,17 +353,18 @@ impl NearVM { // outcome). And `cache`, being a database, can fail with an `io::Error`. let _span = tracing::debug_span!(target: "vm", "NearVM::compile_and_load").entered(); let key = get_contract_cache_key(code, &self.config); - let cache_record = cache - .map(|cache| cache.get(&key)) - .transpose() - .map_err(CacheError::ReadError)? - .flatten(); + let cache_record = { + let _span = tracing::debug_span!(target:"vm", "NearVM::read_cache_record").entered(); + cache.map(|cache| cache.get(&key)).transpose().map_err(CacheError::ReadError)?.flatten() + }; let stored_artifact: Option = match cache_record { None => None, Some(CompiledContract::CompileModuleError(err)) => return Ok(Err(err)), Some(CompiledContract::Code(serialized_module)) => { - let _span = tracing::debug_span!(target: "vm", "NearVM::read_from_cache").entered(); + let _span = + tracing::debug_span!(target: "vm", "NearVM::deserialize_module_from_cache") + .entered(); unsafe { // (UN-)SAFETY: the `serialized_module` must have been produced by a prior call to // `serialize`.