mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 18:31:05 +00:00
Add pov_size and code_size histograms (#6633)
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
This commit is contained in:
@@ -23,6 +23,8 @@ pub(crate) struct MetricsInner {
|
||||
pub(crate) validate_from_chain_state: prometheus::Histogram,
|
||||
pub(crate) validate_from_exhaustive: prometheus::Histogram,
|
||||
pub(crate) validate_candidate_exhaustive: prometheus::Histogram,
|
||||
pub(crate) pov_size: prometheus::Histogram,
|
||||
pub(crate) code_size: prometheus::Histogram,
|
||||
}
|
||||
|
||||
/// Candidate validation metrics.
|
||||
@@ -68,6 +70,18 @@ impl Metrics {
|
||||
.as_ref()
|
||||
.map(|metrics| metrics.validate_candidate_exhaustive.start_timer())
|
||||
}
|
||||
|
||||
pub fn observe_code_size(&self, code_size: usize) {
|
||||
if let Some(metrics) = &self.0 {
|
||||
metrics.code_size.observe(code_size as f64);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn observe_pov_size(&self, pov_size: usize) {
|
||||
if let Some(metrics) = &self.0 {
|
||||
metrics.pov_size.observe(pov_size as f64);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl metrics::Metrics for Metrics {
|
||||
@@ -104,6 +118,32 @@ impl metrics::Metrics for Metrics {
|
||||
))?,
|
||||
registry,
|
||||
)?,
|
||||
pov_size: prometheus::register(
|
||||
prometheus::Histogram::with_opts(
|
||||
prometheus::HistogramOpts::new(
|
||||
"polkadot_parachain_candidate_validation_pov_size",
|
||||
"The size of the decompressed proof of validity of a candidate",
|
||||
)
|
||||
.buckets(
|
||||
prometheus::exponential_buckets(16384.0, 2.0, 10)
|
||||
.expect("arguments are always valid; qed"),
|
||||
),
|
||||
)?,
|
||||
registry,
|
||||
)?,
|
||||
code_size: prometheus::register(
|
||||
prometheus::Histogram::with_opts(
|
||||
prometheus::HistogramOpts::new(
|
||||
"polkadot_parachain_candidate_validation_code_size",
|
||||
"The size of the decompressed WASM validation blob used for checking a candidate",
|
||||
)
|
||||
.buckets(
|
||||
prometheus::exponential_buckets(16384.0, 2.0, 10)
|
||||
.expect("arguments are always valid; qed"),
|
||||
),
|
||||
)?,
|
||||
registry,
|
||||
)?,
|
||||
};
|
||||
Ok(Metrics(Some(metrics)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user