Add `tracing` spans to light client chain scanning

This enables downstream users to profile how much time is spent in each
of the main subcomponents of the current chain scanner.
This commit is contained in:
Jack Grigg 2022-12-06 08:17:49 +00:00
parent 4435c4789f
commit 7e71cc5353
6 changed files with 13 additions and 0 deletions

View File

@ -6,6 +6,9 @@ and this library adheres to Rust's notion of
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Added
- `zcash_client_backend::data_api::chain::scan_cached_blocks` now generates
`tracing` spans, which can be used for profiling.
## [0.6.0] - 2022-11-12
### Added

View File

@ -209,6 +209,7 @@ where
///
/// Scanned blocks are required to be height-sequential. If a block is missing from the block
/// source, an error will be returned with cause [`error::Cause::BlockHeightDiscontinuity`].
#[tracing::instrument(skip(params, block_source, data_db))]
#[allow(clippy::type_complexity)]
pub fn scan_cached_blocks<ParamsT, DbT, BlockSourceT>(
params: &ParamsT,

View File

@ -157,6 +157,7 @@ type TaggedBatch<P, S> = Batch<(AccountId, S), SaplingDomain<P>, CompactOutputDe
type TaggedBatchRunner<P, S, T> =
BatchRunner<(AccountId, S), SaplingDomain<P>, CompactOutputDescription, T>;
#[tracing::instrument(skip_all, fields(height = block.height))]
pub(crate) fn add_block_to_runner<P, S, T>(
params: &P,
block: CompactBlock,
@ -189,6 +190,7 @@ pub(crate) fn add_block_to_runner<P, S, T>(
}
}
#[tracing::instrument(skip_all, fields(height = block.height))]
pub(crate) fn scan_block_with_runner<
P: consensus::Parameters + Send + 'static,
K: ScanningKey,

View File

@ -6,6 +6,9 @@ and this library adheres to Rust's notion of
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Added
- `zcash_client_sqlite::DataConnStmtCache::advance_by_block` now generates a
`tracing` span, which can be used for profiling.
## [0.4.0] - 2022-11-12
### Added

View File

@ -23,6 +23,9 @@ zcash_primitives = { version = "0.9", path = "../zcash_primitives" }
bs58 = { version = "0.4", features = ["check"] }
hdwallet = { version = "0.3.1", optional = true }
# - Logging and metrics
tracing = "0.1"
# - Protobuf interfaces
prost = "0.11"

View File

@ -517,6 +517,7 @@ impl<'a, P: consensus::Parameters> WalletWrite for DataConnStmtCache<'a, P> {
}
}
#[tracing::instrument(skip_all, fields(height = u32::from(block.block_height)))]
#[allow(clippy::type_complexity)]
fn advance_by_block(
&mut self,