Add performance tracing to validate_transaction (#5671)

* Validate transaction timeouts

* Add timing

* Add tracing to transaction validation.

* Fix docs.

Co-authored-by: NikVolf <nikvolf@gmail.com>
This commit is contained in:
Tomasz Drwięga
2020-04-17 08:42:50 +02:00
committed by GitHub
parent 372f8b2c7e
commit bc0b8fbddf
5 changed files with 68 additions and 15 deletions
+12 -11
View File
@@ -16,19 +16,20 @@ codec = { package = "parity-scale-codec", version = "1.3.0" }
derive_more = "0.99.2"
futures = { version = "0.3.1", features = ["compat"] }
futures-diagnose = "1.0"
log = "0.4.8"
parking_lot = "0.10.0"
wasm-timer = "0.2"
sp-core = { version = "2.0.0-dev", path = "../../primitives/core" }
sp-api = { version = "2.0.0-dev", path = "../../primitives/api" }
sp-runtime = { version = "2.0.0-dev", path = "../../primitives/runtime" }
sp-utils = { version = "2.0.0-dev", path = "../../primitives/utils" }
sc-transaction-graph = { version = "2.0.0-dev", path = "./graph" }
sp-transaction-pool = { version = "2.0.0-dev", path = "../../primitives/transaction-pool" }
sc-client-api = { version = "2.0.0-dev", path = "../api" }
sp-blockchain = { version = "2.0.0-dev", path = "../../primitives/blockchain" }
intervalier = "0.4.0"
log = "0.4.8"
parity-util-mem = { version = "0.6.1", default-features = false, features = ["primitive-types"] }
parking_lot = "0.10.0"
sc-client-api = { version = "2.0.0-dev", path = "../api" }
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-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]
assert_matches = "1.3.0"
@@ -89,12 +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();
let runtime_api = client.runtime_api();
let has_v2 = 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();
let res = if has_v2 {
runtime_api.validate_transaction(&at, source, uxt)
} else {