mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-19 20:25:40 +00:00
Histogram support in runtime metrics (#6935)
* Histogram support in runtime metrics Add support for histograms to the runtime metrics. Additionally add `polkadot_parachain_verify_dispute_signature` histogram which tracks the time needed from the runtime to verify a single validator signature of a dispute statement. * Add noops * u64 instead of f64 * Update buckets * Wrap `get_current_time()` in runtime metrics * Change the dimension of the Histogram from usec to sec * Fix a compilation error * Update buckets * Fix `on_signature_check_complete` calculation * Update buckets * Update buckets * formatting * Another weights update * Adjust buckets again * Final buckets adjustment * Revert "Fix a compilation error" This reverts commit 06290b40a39eeb78de2602d8916a39edf7a8b714. * Update primitives/src/v4/metrics.rs Co-authored-by: Andrei Sandu <54316454+sandreim@users.noreply.github.com> * Use `saturating_sub` for time difference calculation * Pass nanoseconds to client instead of seconds (using f64 in runtime is dangerous) --------- Co-authored-by: Andrei Sandu <54316454+sandreim@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
4903859544
commit
22f404f092
@@ -27,6 +27,8 @@ pub enum RuntimeMetricOp {
|
||||
IncrementCounterVec(u64, RuntimeMetricLabelValues),
|
||||
/// Increment a counter metric by value.
|
||||
IncrementCounter(u64),
|
||||
/// Observe histogram value
|
||||
ObserveHistogram(u128),
|
||||
}
|
||||
|
||||
/// Runtime metric update event.
|
||||
@@ -127,6 +129,16 @@ pub mod metric_definitions {
|
||||
pub labels: &'a [&'static str],
|
||||
}
|
||||
|
||||
/// `Histogram` metric definition
|
||||
pub struct HistogramDefinition<'a> {
|
||||
/// The name of the metric.
|
||||
pub name: &'static str,
|
||||
/// The description of the metric.
|
||||
pub description: &'static str,
|
||||
/// The buckets for the histogram
|
||||
pub buckets: &'a [f64],
|
||||
}
|
||||
|
||||
/// Counts parachain inherent data weights. Use `before` and `after` labels to differentiate
|
||||
/// between the weight before and after filtering.
|
||||
pub const PARACHAIN_INHERENT_DATA_WEIGHT: CounterVecDefinition = CounterVecDefinition {
|
||||
@@ -176,4 +188,12 @@ pub mod metric_definitions {
|
||||
description: "Counts the number of bitfields signature checked in `enter_inner`.",
|
||||
labels: &["validity"],
|
||||
};
|
||||
|
||||
/// Measures how much time does it take to verify a single validator signature of a dispute statement
|
||||
pub const PARACHAIN_VERIFY_DISPUTE_SIGNATURE: HistogramDefinition =
|
||||
HistogramDefinition {
|
||||
name: "polkadot_parachain_verify_dispute_signature",
|
||||
description: "How much time does it take to verify a single validator signature of a dispute statement, in seconds",
|
||||
buckets: &[0.0, 0.00005, 0.00006, 0.0001, 0.0005, 0.001, 0.005, 0.01, 0.05, 0.1, 0.3, 0.5, 1.0],
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user