Skip to content

Commit

Permalink
Implement tracing::Event handling & parent_id for spans and events (p…
Browse files Browse the repository at this point in the history
…aritytech#6672)

* implement events handling, implement parent_id for spans & events

* add events to sp_io::storage

* update test

* add tests

* adjust limit

* let tracing crate handle parent_ids

* re-enable current-id tracking

* add test for threads with CurrentSpan

* fix log level

* remove redundant check for non wasm traces

* remove duplicate definition in test

* Adding conditional events API

* prefer explicit parent_id over current,

enhance test

* limit changes to client::tracing event implementation

* remove From impl due to fallback required on parent_id

* implement SPAN_LIMIT

change event log output

* change version of tracing-core

* update dependancies

* revert limit

* remove duplicate dependency

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

Co-authored-by: Matt Rutherford <mattrutherford@users.noreply.github.com>
Co-authored-by: Benjamin Kampmann <ben@parity.io>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
  • Loading branch information
4 people committed Aug 12, 2020
1 parent 5b809d2 commit 0c3cdf1
Show file tree
Hide file tree
Showing 10 changed files with 288 additions and 49 deletions.
74 changes: 67 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bin/node/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jsonrpc-pubsub = "14.2.0"
log = "0.4.8"
rand = "0.7.2"
structopt = { version = "0.3.8", optional = true }
tracing = "0.1.10"
tracing = "0.1.18"
parking_lot = "0.10.0"

# primitives
Expand Down
2 changes: 1 addition & 1 deletion client/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ pub fn init_logger(pattern: &str) {
builder.filter(Some("hyper"), log::LevelFilter::Warn);
builder.filter(Some("cranelift_wasm"), log::LevelFilter::Warn);
// Always log the special target `sc_tracing`, overrides global level
builder.filter(Some("sc_tracing"), log::LevelFilter::Info);
builder.filter(Some("sc_tracing"), log::LevelFilter::Trace);
// Enable info for others.
builder.filter(None, log::LevelFilter::Info);

Expand Down
2 changes: 1 addition & 1 deletion client/executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ test-case = "0.3.3"
sp-runtime = { version = "2.0.0-rc5", path = "../../primitives/runtime" }
sp-tracing = { version = "2.0.0-rc5", path = "../../primitives/tracing" }
sc-tracing = { version = "2.0.0-rc5", path = "../tracing" }
tracing = "0.1.14"
tracing = "0.1.18"

[features]
default = [ "std" ]
Expand Down
5 changes: 4 additions & 1 deletion client/executor/src/integration_tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -661,14 +661,17 @@ fn parallel_execution(wasm_method: WasmExecutionMethod) {
fn wasm_tracing_should_work(wasm_method: WasmExecutionMethod) {

use std::sync::{Arc, Mutex};
use sc_tracing::SpanDatum;

use sc_tracing::{SpanDatum, TraceEvent};

struct TestTraceHandler(Arc<Mutex<Vec<SpanDatum>>>);

impl sc_tracing::TraceHandler for TestTraceHandler {
fn handle_span(&self, sd: SpanDatum) {
self.0.lock().unwrap().push(sd);
}

fn handle_event(&self, _event: TraceEvent) {}
}

let traces = Arc::new(Mutex::new(Vec::new()));
Expand Down
2 changes: 1 addition & 1 deletion client/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ sc-telemetry = { version = "2.0.0-rc5", path = "../telemetry" }
sc-offchain = { version = "2.0.0-rc5", path = "../offchain" }
prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../utils/prometheus", version = "0.8.0-rc5"}
sc-tracing = { version = "2.0.0-rc5", path = "../tracing" }
tracing = "0.1.10"
tracing = "0.1.18"
parity-util-mem = { version = "0.7.0", default-features = false, features = ["primitive-types"] }

[target.'cfg(not(target_os = "unknown"))'.dependencies]
Expand Down
6 changes: 2 additions & 4 deletions client/tracing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ rustc-hash = "1.1.0"
serde = "1.0.101"
serde_json = "1.0.41"
slog = { version = "2.5.2", features = ["nested-values"] }
tracing-core = "0.1.7"
tracing = "0.1.18"
tracing-subscriber = "0.2.10"
sp-tracing = { version = "2.0.0-rc2", path = "../../primitives/tracing" }

sc-telemetry = { version = "2.0.0-rc5", path = "../telemetry" }

[dev-dependencies]
tracing = "0.1.10"
Loading

0 comments on commit 0c3cdf1

Please sign in to comment.