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:
Andrei Sandu
2023-06-21 17:02:57 +03:00
committed by GitHub
parent 4c0af07370
commit 02d3fd025d
2 changed files with 21 additions and 0 deletions
@@ -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",