Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Change TRACING_SET to static #7607

Merged
merged 4 commits into from
Nov 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions client/executor/runtime-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,17 @@ sp_core::wasm_export_functions! {
wasm_tracing::exit(span_id)
}

fn test_nested_spans() {
sp_io::init_tracing();
let span_id = wasm_tracing::enter_span(Default::default());
{
sp_io::init_tracing();
let span_id = wasm_tracing::enter_span(Default::default());
wasm_tracing::exit(span_id);
}
wasm_tracing::exit(span_id);
}

fn returns_mutable_static() -> u64 {
unsafe {
MUTABLE_STATIC += 1;
Expand Down
9 changes: 9 additions & 0 deletions client/executor/src/integration_tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,15 @@ fn wasm_tracing_should_work(wasm_method: WasmExecutionMethod) {
assert_eq!(span_datum.target, "default");
assert_eq!(span_datum.name, "");
assert_eq!(values.bool_values.get("wasm").unwrap(), &true);

call_in_wasm(
"test_nested_spans",
Default::default(),
wasm_method,
&mut ext,
).unwrap();
let len = traces.lock().unwrap().len();
assert_eq!(len, 2);
}

#[test_case(WasmExecutionMethod::Interpreted)]
Expand Down
2 changes: 1 addition & 1 deletion primitives/io/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,7 @@ mod tracing_setup {
};
use super::{wasm_tracing, Crossing};

const TRACING_SET : AtomicBool = AtomicBool::new(false);
static TRACING_SET: AtomicBool = AtomicBool::new(false);


/// The PassingTracingSubscriber implements `tracing_core::Subscriber`
Expand Down