mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 07:41:08 +00:00
Improve tracing (#5698)
* Improve tracing implementation * Enable tracing in runtime interfaces * Switch to `TRACE` level
This commit is contained in:
@@ -20,20 +20,8 @@
|
||||
//!
|
||||
//! # Usage
|
||||
//!
|
||||
//! Monitor performance throughout the codebase via the creation of `Span`s.
|
||||
//! A span is set in the following way:
|
||||
//! ```
|
||||
//! let span = tracing::span!(tracing::Level::INFO, "my_span_name");
|
||||
//! let _guard = span.enter();
|
||||
//! ```
|
||||
//! To begin timing, a span must be entered. When the span is dropped, the execution time
|
||||
//! is recorded and details sent to the `Receiver` which defines how to process it.
|
||||
//! See `sp-tracing` for examples on how to use tracing.
|
||||
//!
|
||||
//! It's possible to record values with each span in the following way:
|
||||
//! ```
|
||||
//! let span = tracing::span!(tracing::Level::INFO, "my_span_name", my_number = 10, a_key = "a value");
|
||||
//! let _guard = span.enter();
|
||||
//! ```
|
||||
//! Currently we provide `Log` (default), `Telemetry` variants for `Receiver`
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
@@ -26,10 +26,10 @@ sc-transaction-graph = { version = "2.0.0-dev", path = "./graph" }
|
||||
sp-api = { version = "2.0.0-dev", path = "../../primitives/api" }
|
||||
sp-core = { version = "2.0.0-dev", path = "../../primitives/core" }
|
||||
sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" }
|
||||
sp-tracing = { version = "2.0.0-dev", path = "../../primitives/tracing" }
|
||||
sp-transaction-pool = { version = "2.0.0-dev", path = "../../primitives/transaction-pool" }
|
||||
sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" }
|
||||
sp-utils = { version = "2.0.0-dev", path = "../../primitives/utils" }
|
||||
tracing = "0.1.10"
|
||||
wasm-timer = "0.2"
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
@@ -89,17 +89,17 @@ impl<Client, Block> sc_transaction_graph::ChainApi for FullChainApi<Client, Bloc
|
||||
let at = at.clone();
|
||||
|
||||
self.pool.spawn_ok(futures_diagnose::diagnose("validate-transaction", async move {
|
||||
let span = tracing::span!(tracing::Level::DEBUG, "validate_transaction::check_version");
|
||||
let guard = span.enter();
|
||||
sp_tracing::enter_span!("validate_transaction");
|
||||
let runtime_api = client.runtime_api();
|
||||
let has_v2 = runtime_api
|
||||
let has_v2 = sp_tracing::tracing_span! { "check_version";
|
||||
runtime_api
|
||||
.has_api_with::<dyn TaggedTransactionQueue<Self::Block, Error=()>, _>(
|
||||
&at, |v| v >= 2,
|
||||
)
|
||||
.unwrap_or_default();
|
||||
std::mem::drop(guard);
|
||||
let span = tracing::span!(tracing::Level::DEBUG, "validate_transaction");
|
||||
let _guard = span.enter();
|
||||
.unwrap_or_default()
|
||||
};
|
||||
|
||||
sp_tracing::enter_span!("runtime::validate_transaction");
|
||||
let res = if has_v2 {
|
||||
runtime_api.validate_transaction(&at, source, uxt)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user