Skip to content

Commit

Permalink
Improve some tracing spans (#10774)
Browse files Browse the repository at this point in the history
Add a span and improve the naming of another

---------

Co-authored-by: Simonas Kazlauskas <[email protected]>
  • Loading branch information
akhi3030 and nagisa authored Mar 13, 2024
1 parent 7a11e47 commit ab86958
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions runtime/near-vm-runner/src/near_vm_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<VMArtifact> = 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`.
Expand Down

0 comments on commit ab86958

Please sign in to comment.