Doc comments for metrics in provisioner (#5967)

This commit is contained in:
Tsvetomir Dimitrov
2022-09-05 15:48:35 +03:00
committed by GitHub
parent b3480bd51f
commit accc08c3aa
+12 -6
View File
@@ -18,9 +18,13 @@ use polkadot_node_subsystem_util::metrics::{self, prometheus};
#[derive(Clone)] #[derive(Clone)]
struct MetricsInner { struct MetricsInner {
/// Tracks successful/unsuccessful inherent data requests
inherent_data_requests: prometheus::CounterVec<prometheus::U64>, inherent_data_requests: prometheus::CounterVec<prometheus::U64>,
request_inherent_data: prometheus::Histogram, /// How much time the `RequestInherentData` processing takes
provisionable_data: prometheus::Histogram, request_inherent_data_duration: prometheus::Histogram,
/// How much time `ProvisionableData` processing takes
provisionable_data_duration: prometheus::Histogram,
/// Bitfields array length in `ProvisionerInherentData` (the result for `RequestInherentData`)
inherent_data_response_bitfields: prometheus::Histogram, inherent_data_response_bitfields: prometheus::Histogram,
/// The following metrics track how many disputes/votes the runtime will have to process. These will count /// The following metrics track how many disputes/votes the runtime will have to process. These will count
@@ -54,14 +58,16 @@ impl Metrics {
pub(crate) fn time_request_inherent_data( pub(crate) fn time_request_inherent_data(
&self, &self,
) -> Option<metrics::prometheus::prometheus::HistogramTimer> { ) -> Option<metrics::prometheus::prometheus::HistogramTimer> {
self.0.as_ref().map(|metrics| metrics.request_inherent_data.start_timer()) self.0
.as_ref()
.map(|metrics| metrics.request_inherent_data_duration.start_timer())
} }
/// Provide a timer for `provisionable_data` which observes on drop. /// Provide a timer for `provisionable_data` which observes on drop.
pub(crate) fn time_provisionable_data( pub(crate) fn time_provisionable_data(
&self, &self,
) -> Option<metrics::prometheus::prometheus::HistogramTimer> { ) -> Option<metrics::prometheus::prometheus::HistogramTimer> {
self.0.as_ref().map(|metrics| metrics.provisionable_data.start_timer()) self.0.as_ref().map(|metrics| metrics.provisionable_data_duration.start_timer())
} }
pub(crate) fn observe_inherent_data_bitfields_count(&self, bitfields_count: usize) { pub(crate) fn observe_inherent_data_bitfields_count(&self, bitfields_count: usize) {
@@ -110,14 +116,14 @@ impl metrics::Metrics for Metrics {
)?, )?,
registry, registry,
)?, )?,
request_inherent_data: prometheus::register( request_inherent_data_duration: prometheus::register(
prometheus::Histogram::with_opts(prometheus::HistogramOpts::new( prometheus::Histogram::with_opts(prometheus::HistogramOpts::new(
"polkadot_parachain_provisioner_request_inherent_data_time", "polkadot_parachain_provisioner_request_inherent_data_time",
"Time spent within `provisioner::request_inherent_data`", "Time spent within `provisioner::request_inherent_data`",
))?, ))?,
registry, registry,
)?, )?,
provisionable_data: prometheus::register( provisionable_data_duration: prometheus::register(
prometheus::Histogram::with_opts(prometheus::HistogramOpts::new( prometheus::Histogram::with_opts(prometheus::HistogramOpts::new(
"polkadot_parachain_provisioner_provisionable_data_time", "polkadot_parachain_provisioner_provisionable_data_time",
"Time spent within `provisioner::provisionable_data`", "Time spent within `provisioner::provisionable_data`",