diff --git a/runtime/near-vm/compiler-singlepass/src/codegen_x64.rs b/runtime/near-vm/compiler-singlepass/src/codegen_x64.rs index 335e050463b..00f03199abe 100644 --- a/runtime/near-vm/compiler-singlepass/src/codegen_x64.rs +++ b/runtime/near-vm/compiler-singlepass/src/codegen_x64.rs @@ -1695,7 +1695,7 @@ impl<'a> FuncGen<'a> { }); } - #[tracing::instrument(skip_all)] + #[tracing::instrument(target = "near_vm", skip_all)] pub(crate) fn new( assembler: &'a mut Assembler, module: &'a ModuleInfo, @@ -1802,7 +1802,7 @@ impl<'a> FuncGen<'a> { None } - #[tracing::instrument(skip(self))] + #[tracing::instrument(target = "near_vm", skip(self))] pub(crate) fn feed_operator(&mut self, op: Operator) -> Result<(), CodegenError> { assert!(self.fp_stack.len() <= self.value_stack.len()); @@ -7663,7 +7663,7 @@ impl<'a> FuncGen<'a> { Ok(()) } - #[tracing::instrument(skip_all)] + #[tracing::instrument(target = "near_vm", skip_all)] pub(crate) fn finalize(mut self, data: &FunctionBodyData) -> CompiledFunction { debug_assert!( self.gas_iter.next().is_none(), @@ -7776,7 +7776,7 @@ fn sort_call_movs(movs: &mut [(Location, GPR)]) { } // Standard entry trampoline. -#[tracing::instrument] +#[tracing::instrument(target = "near_vm")] pub(crate) fn gen_std_trampoline( sig: &FunctionType, calling_convention: CallingConvention, @@ -7869,7 +7869,7 @@ pub(crate) fn gen_std_trampoline( } /// Generates dynamic import function call trampoline for a function type. -#[tracing::instrument(skip(vmoffsets))] +#[tracing::instrument(target = "near_vm", skip(vmoffsets))] pub(crate) fn gen_std_dynamic_import_trampoline( vmoffsets: &VMOffsets, sig: &FunctionType, @@ -7987,7 +7987,7 @@ pub(crate) fn gen_std_dynamic_import_trampoline( } // Singlepass calls import functions through a trampoline. -#[tracing::instrument(skip(vmoffsets))] +#[tracing::instrument(target = "near_vm", skip(vmoffsets))] pub(crate) fn gen_import_call_trampoline( vmoffsets: &VMOffsets, index: FunctionIndex, diff --git a/runtime/near-vm/compiler-singlepass/src/compiler.rs b/runtime/near-vm/compiler-singlepass/src/compiler.rs index fbe81e9d564..ed0b4911671 100644 --- a/runtime/near-vm/compiler-singlepass/src/compiler.rs +++ b/runtime/near-vm/compiler-singlepass/src/compiler.rs @@ -41,7 +41,7 @@ impl SinglepassCompiler { impl Compiler for SinglepassCompiler { /// Compile the module using Singlepass, producing a compilation result with /// associated relocations. - #[tracing::instrument(skip_all)] + #[tracing::instrument(target = "near_vm", skip_all)] fn compile_module( &self, target: &Target, @@ -87,7 +87,7 @@ impl Compiler for SinglepassCompiler { }; let import_idxs = 0..module.import_counts.functions as usize; let import_trampolines: PrimaryMap = - tracing::info_span!("import_trampolines", n_imports = import_idxs.len()).in_scope( + tracing::info_span!(target: "near_vm", "import_trampolines", n_imports = import_idxs.len()).in_scope( || { import_idxs .into_par_iter() @@ -111,7 +111,7 @@ impl Compiler for SinglepassCompiler { .collect::)>>() .into_par_iter() .map_init(make_assembler, |assembler, (i, input)| { - tracing::info_span!("function", i = i.index()).in_scope(|| { + tracing::info_span!(target: "near_vm", "function", i = i.index()).in_scope(|| { let reader = near_vm_compiler::FunctionReader::new(input.module_offset, input.data); let stack_init_gas_cost = tunables @@ -154,8 +154,9 @@ impl Compiler for SinglepassCompiler { let mut operator_reader = reader.get_operators_reader()?.into_iter_with_offsets(); while generator.has_control_frames() { - let (op, pos) = tracing::info_span!("parsing-next-operator") - .in_scope(|| operator_reader.next().unwrap())?; + let (op, pos) = + tracing::info_span!(target: "near_vm", "parsing-next-operator") + .in_scope(|| operator_reader.next().unwrap())?; generator.set_srcloc(pos as u32); generator.feed_operator(op).map_err(to_compile_error)?; } @@ -168,7 +169,7 @@ impl Compiler for SinglepassCompiler { .collect::>(); let function_call_trampolines = - tracing::info_span!("function_call_trampolines").in_scope(|| { + tracing::info_span!(target: "near_vm", "function_call_trampolines").in_scope(|| { module .signatures .values() @@ -182,8 +183,8 @@ impl Compiler for SinglepassCompiler { .collect::>() }); - let dynamic_function_trampolines = tracing::info_span!("dynamic_function_trampolines") - .in_scope(|| { + let dynamic_function_trampolines = + tracing::info_span!(target: "near_vm", "dynamic_function_trampolines").in_scope(|| { module .imported_function_types() .collect::>() diff --git a/runtime/near-vm/compiler/src/translator/environ.rs b/runtime/near-vm/compiler/src/translator/environ.rs index e6125c8fcc0..57b1326b3f5 100644 --- a/runtime/near-vm/compiler/src/translator/environ.rs +++ b/runtime/near-vm/compiler/src/translator/environ.rs @@ -59,7 +59,7 @@ impl<'data> ModuleEnvironment<'data> { /// Translate a wasm module using this environment. This consumes the /// `ModuleEnvironment` and produces a `ModuleInfoTranslation`. - #[tracing::instrument(skip_all)] + #[tracing::instrument(target = "near_vm", skip_all)] pub fn translate(mut self, data: &'data [u8]) -> WasmResult> { assert!(self.module_translation_state.is_none()); let module_translation_state = translate_module(data, &mut self)?; diff --git a/runtime/near-vm/compiler/src/translator/module.rs b/runtime/near-vm/compiler/src/translator/module.rs index 84ba7968385..44ad52829d3 100644 --- a/runtime/near-vm/compiler/src/translator/module.rs +++ b/runtime/near-vm/compiler/src/translator/module.rs @@ -15,7 +15,7 @@ use wasmparser::{NameSectionReader, Parser, Payload}; /// Translate a sequence of bytes forming a valid Wasm binary into a /// parsed ModuleInfo `ModuleTranslationState`. -#[tracing::instrument(skip_all)] +#[tracing::instrument(target = "near_vm", skip_all)] pub fn translate_module<'data>( data: &'data [u8], environ: &mut ModuleEnvironment<'data>, diff --git a/runtime/near-vm/compiler/src/translator/state.rs b/runtime/near-vm/compiler/src/translator/state.rs index 91bdc0bd017..09f79762690 100644 --- a/runtime/near-vm/compiler/src/translator/state.rs +++ b/runtime/near-vm/compiler/src/translator/state.rs @@ -35,7 +35,7 @@ impl ModuleTranslationState { } /// Build map of imported functions names for intrinsification. - #[tracing::instrument(skip_all)] + #[tracing::instrument(target = "near_vm", skip_all)] pub fn build_import_map(&mut self, module: &ModuleInfo) { for key in module.imports.keys() { let value = &module.imports[key]; diff --git a/runtime/near-vm/engine/src/universal/code_memory.rs b/runtime/near-vm/engine/src/universal/code_memory.rs index f4b4c6a2407..501e37b3d2e 100644 --- a/runtime/near-vm/engine/src/universal/code_memory.rs +++ b/runtime/near-vm/engine/src/universal/code_memory.rs @@ -228,6 +228,7 @@ impl Drop for CodeMemory { unsafe { if let Err(e) = mm::munmap(self.map.cast(), self.size) { tracing::error!( + target: "near_vm", message="could not unmap mapping", map=?self.map, size=self.size, error=%e ); diff --git a/runtime/near-vm/engine/src/universal/engine.rs b/runtime/near-vm/engine/src/universal/engine.rs index bcd0fbb5c2f..55291a362a1 100644 --- a/runtime/near-vm/engine/src/universal/engine.rs +++ b/runtime/near-vm/engine/src/universal/engine.rs @@ -91,7 +91,7 @@ impl UniversalEngine { } /// Compile a WebAssembly binary - #[tracing::instrument(skip_all)] + #[tracing::instrument(target = "near_vm", skip_all)] pub fn compile_universal( &self, binary: &[u8], @@ -181,7 +181,7 @@ impl UniversalEngine { } /// Load a [`UniversalExecutable`](crate::UniversalExecutable) with this engine. - #[tracing::instrument(skip_all)] + #[tracing::instrument(target = "near_vm", skip_all)] pub fn load_universal_executable( &self, executable: &UniversalExecutable, @@ -470,7 +470,7 @@ impl UniversalEngine { } /// Validates a WebAssembly module - #[tracing::instrument(skip_all)] + #[tracing::instrument(target = "near_vm", skip_all)] pub fn validate(&self, binary: &[u8]) -> Result<(), CompileError> { self.inner().validate(binary) } diff --git a/runtime/near-vm/engine/src/universal/link.rs b/runtime/near-vm/engine/src/universal/link.rs index 30ba0df9e8a..1dc7b4bc8ea 100644 --- a/runtime/near-vm/engine/src/universal/link.rs +++ b/runtime/near-vm/engine/src/universal/link.rs @@ -165,7 +165,7 @@ fn apply_relocation( /// Links a module, patching the allocated functions with the /// required relocations and jump tables. -#[tracing::instrument(skip_all)] +#[tracing::instrument(target = "near_vm", skip_all)] pub fn link_module( allocated_functions: &PrimaryMap, jt_offsets: impl Fn(LocalFunctionIndex, JumpTable) -> near_vm_compiler::CodeOffset, diff --git a/runtime/near-vm/test-api/src/sys/instance.rs b/runtime/near-vm/test-api/src/sys/instance.rs index aad589112db..8ca44e81e68 100644 --- a/runtime/near-vm/test-api/src/sys/instance.rs +++ b/runtime/near-vm/test-api/src/sys/instance.rs @@ -102,7 +102,7 @@ impl Instance { /// Those are, as defined by the spec: /// * Link errors that happen when plugging the imports into the instance /// * Runtime errors that happen when running the module `start` function. - #[tracing::instrument(skip_all)] + #[tracing::instrument(target = "near_vm", skip_all)] pub fn new_with_config( module: &Module, config: InstanceConfig, diff --git a/runtime/near-vm/test-api/src/sys/module.rs b/runtime/near-vm/test-api/src/sys/module.rs index 157e12e55f5..051182c7fd3 100644 --- a/runtime/near-vm/test-api/src/sys/module.rs +++ b/runtime/near-vm/test-api/src/sys/module.rs @@ -96,7 +96,7 @@ impl Module { /// # } /// ``` #[allow(unreachable_code)] - #[tracing::instrument(skip_all)] + #[tracing::instrument(target = "near_vm", skip_all)] pub fn new(store: &Store, bytes: impl AsRef<[u8]>) -> Result { #[cfg(feature = "wat")] let bytes = wat::parse_bytes(bytes.as_ref()).map_err(|e| { @@ -111,7 +111,7 @@ impl Module { /// Opposed to [`Module::new`], this function is not compatible with /// the WebAssembly text format (if the "wat" feature is enabled for /// this crate). - #[tracing::instrument(skip_all)] + #[tracing::instrument(target = "near_vm", skip_all)] pub(crate) fn from_binary(store: &Store, binary: &[u8]) -> Result { let engine = store.engine(); engine.validate(binary)?; diff --git a/runtime/near-vm/vm/src/instance/mod.rs b/runtime/near-vm/vm/src/instance/mod.rs index 57b340ed597..ebadafa8444 100644 --- a/runtime/near-vm/vm/src/instance/mod.rs +++ b/runtime/near-vm/vm/src/instance/mod.rs @@ -1146,7 +1146,7 @@ impl InstanceHandle { /// visible to code in `near_vm_vm`, so it's the caller's responsibility to ensure these /// functions are called with the correct type. /// - `instance_ptr` must point to a valid `near_vm_test_api::Instance`. -#[tracing::instrument(skip_all)] +#[tracing::instrument(target = "near_vm", skip_all)] pub unsafe fn initialize_host_envs( handle: &std::sync::Mutex, instance_ptr: *const ffi::c_void, diff --git a/runtime/near-vm/vm/src/vmoffsets.rs b/runtime/near-vm/vm/src/vmoffsets.rs index 7c7e5ba909e..639407f100c 100644 --- a/runtime/near-vm/vm/src/vmoffsets.rs +++ b/runtime/near-vm/vm/src/vmoffsets.rs @@ -116,7 +116,7 @@ impl VMOffsets { } /// Add imports and locals from the provided ModuleInfo. - #[tracing::instrument(skip_all)] + #[tracing::instrument(target = "near_vm", skip_all)] pub fn with_module_info(mut self, module: &ModuleInfo) -> Self { self.num_imported_functions = module.import_counts.functions; self.num_imported_tables = module.import_counts.tables;