mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-18 09:31:02 +00:00
Logs for large messages + metrics on size. (#5143)
* Logs for large messages + metrics on size. * Fix typo
This commit is contained in:
@@ -25,6 +25,7 @@ struct MetricsInner {
|
||||
share: prometheus::Histogram,
|
||||
network_bridge_update_v1: prometheus::Histogram,
|
||||
statements_unexpected: prometheus::CounterVec<prometheus::U64>,
|
||||
created_message_size: prometheus::Gauge<prometheus::U64>,
|
||||
}
|
||||
|
||||
/// Statement Distribution metrics.
|
||||
@@ -97,6 +98,13 @@ impl Metrics {
|
||||
metrics.statements_unexpected.with_label_values(&["large"]).inc();
|
||||
}
|
||||
}
|
||||
|
||||
/// Report size of a created message.
|
||||
pub fn on_created_message(&self, size: usize) {
|
||||
if let Some(metrics) = &self.0 {
|
||||
metrics.created_message_size.set(size as u64);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl metrics::Metrics for Metrics {
|
||||
@@ -159,6 +167,13 @@ impl metrics::Metrics for Metrics {
|
||||
)?,
|
||||
registry,
|
||||
)?,
|
||||
created_message_size: prometheus::register(
|
||||
prometheus::Gauge::with_opts(prometheus::Opts::new(
|
||||
"polkadot_parachain_statement_distribution_created_message_size",
|
||||
"Size of created messages containing Seconded statements.",
|
||||
))?,
|
||||
registry,
|
||||
)?,
|
||||
};
|
||||
Ok(Metrics(Some(metrics)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user