mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-16 23:41:02 +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(),
|
params.validators.len(),
|
||||||
¶ms.erasure_root,
|
¶ms.erasure_root,
|
||||||
&data,
|
&data,
|
||||||
|
¶ms.metrics,
|
||||||
) {
|
) {
|
||||||
gum::trace!(
|
gum::trace!(
|
||||||
target: LOG_TARGET,
|
target: LOG_TARGET,
|
||||||
@@ -586,6 +587,7 @@ impl RequestChunksFromValidators {
|
|||||||
params.validators.len(),
|
params.validators.len(),
|
||||||
¶ms.erasure_root,
|
¶ms.erasure_root,
|
||||||
&data,
|
&data,
|
||||||
|
&metrics,
|
||||||
) {
|
) {
|
||||||
gum::trace!(
|
gum::trace!(
|
||||||
target: LOG_TARGET,
|
target: LOG_TARGET,
|
||||||
@@ -685,7 +687,10 @@ fn reconstructed_data_matches_root(
|
|||||||
n_validators: usize,
|
n_validators: usize,
|
||||||
expected_root: &Hash,
|
expected_root: &Hash,
|
||||||
data: &AvailableData,
|
data: &AvailableData,
|
||||||
|
metrics: &Metrics,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
|
let _timer = metrics.time_reencode_chunks();
|
||||||
|
|
||||||
let chunks = match obtain_chunks_v1(n_validators, data) {
|
let chunks = match obtain_chunks_v1(n_validators, data) {
|
||||||
Ok(chunks) => chunks,
|
Ok(chunks) => chunks,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
|||||||
@@ -46,6 +46,10 @@ struct MetricsInner {
|
|||||||
/// The duration between the pure recovery and verification.
|
/// The duration between the pure recovery and verification.
|
||||||
time_erasure_recovery: Histogram,
|
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
|
/// Time of a full recovery, including erasure decoding or until we gave
|
||||||
/// up.
|
/// up.
|
||||||
time_full_recovery: Histogram,
|
time_full_recovery: Histogram,
|
||||||
@@ -118,6 +122,11 @@ impl Metrics {
|
|||||||
self.0.as_ref().map(|metrics| metrics.time_erasure_recovery.start_timer())
|
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.
|
/// Get a timer to measure the time of the complete recovery process.
|
||||||
pub fn time_full_recovery(&self) -> Option<metrics::prometheus::prometheus::HistogramTimer> {
|
pub fn time_full_recovery(&self) -> Option<metrics::prometheus::prometheus::HistogramTimer> {
|
||||||
self.0.as_ref().map(|metrics| metrics.time_full_recovery.start_timer())
|
self.0.as_ref().map(|metrics| metrics.time_full_recovery.start_timer())
|
||||||
@@ -186,6 +195,13 @@ impl metrics::Metrics for Metrics {
|
|||||||
))?,
|
))?,
|
||||||
registry,
|
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(
|
time_full_recovery: prometheus::register(
|
||||||
prometheus::Histogram::with_opts(prometheus::HistogramOpts::new(
|
prometheus::Histogram::with_opts(prometheus::HistogramOpts::new(
|
||||||
"polkadot_parachain_availability_recovery_time_total",
|
"polkadot_parachain_availability_recovery_time_total",
|
||||||
|
|||||||
Reference in New Issue
Block a user