mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 12:17:58 +00:00
availability recovery: measure re-encoding time (#7409)
* Measure re-encoding time Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * fix build Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> --------- Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
This commit is contained in:
@@ -255,6 +255,7 @@ impl RequestFromBackers {
|
||||
params.validators.len(),
|
||||
¶ms.erasure_root,
|
||||
&data,
|
||||
¶ms.metrics,
|
||||
) {
|
||||
gum::trace!(
|
||||
target: LOG_TARGET,
|
||||
@@ -586,6 +587,7 @@ impl RequestChunksFromValidators {
|
||||
params.validators.len(),
|
||||
¶ms.erasure_root,
|
||||
&data,
|
||||
&metrics,
|
||||
) {
|
||||
gum::trace!(
|
||||
target: LOG_TARGET,
|
||||
@@ -685,7 +687,10 @@ fn reconstructed_data_matches_root(
|
||||
n_validators: usize,
|
||||
expected_root: &Hash,
|
||||
data: &AvailableData,
|
||||
metrics: &Metrics,
|
||||
) -> bool {
|
||||
let _timer = metrics.time_reencode_chunks();
|
||||
|
||||
let chunks = match obtain_chunks_v1(n_validators, data) {
|
||||
Ok(chunks) => chunks,
|
||||
Err(e) => {
|
||||
|
||||
@@ -46,6 +46,10 @@ struct MetricsInner {
|
||||
/// The duration between the pure recovery and verification.
|
||||
time_erasure_recovery: Histogram,
|
||||
|
||||
/// How much time it takes to re-encode the data into erasure chunks in order to verify
|
||||
/// the root hash of the provided Merkle tree. See `reconstructed_data_matches_root`.
|
||||
time_reencode_chunks: Histogram,
|
||||
|
||||
/// Time of a full recovery, including erasure decoding or until we gave
|
||||
/// up.
|
||||
time_full_recovery: Histogram,
|
||||
@@ -118,6 +122,11 @@ impl Metrics {
|
||||
self.0.as_ref().map(|metrics| metrics.time_erasure_recovery.start_timer())
|
||||
}
|
||||
|
||||
/// Get a timer to time chunk encoding.
|
||||
pub fn time_reencode_chunks(&self) -> Option<metrics::prometheus::prometheus::HistogramTimer> {
|
||||
self.0.as_ref().map(|metrics| metrics.time_reencode_chunks.start_timer())
|
||||
}
|
||||
|
||||
/// Get a timer to measure the time of the complete recovery process.
|
||||
pub fn time_full_recovery(&self) -> Option<metrics::prometheus::prometheus::HistogramTimer> {
|
||||
self.0.as_ref().map(|metrics| metrics.time_full_recovery.start_timer())
|
||||
@@ -186,6 +195,13 @@ impl metrics::Metrics for Metrics {
|
||||
))?,
|
||||
registry,
|
||||
)?,
|
||||
time_reencode_chunks: prometheus::register(
|
||||
prometheus::Histogram::with_opts(prometheus::HistogramOpts::new(
|
||||
"polkadot_parachain_availability_reencode_chunks",
|
||||
"Time spent re-encoding the data as erasure chunks",
|
||||
))?,
|
||||
registry,
|
||||
)?,
|
||||
time_full_recovery: prometheus::register(
|
||||
prometheus::Histogram::with_opts(prometheus::HistogramOpts::new(
|
||||
"polkadot_parachain_availability_recovery_time_total",
|
||||
|
||||
Reference in New Issue
Block a user