penumbra_sdk_app/metrics.rs
1//! Crate-specific metrics functionality.
2//!
3//! This module re-exports the contents of the `metrics` crate. This is
4//! effectively a way to monkey-patch the functions in this module into the
5//! `metrics` crate, at least from the point of view of the other code in this
6//! crate.
7//!
8//! Code in this crate that wants to use metrics should `use crate::metrics;`,
9//! so that this module shadows the `metrics` crate.
10//!
11//! This trick is probably good to avoid in general, because it could be
12//! confusing, but in this limited case, it seems like a clean option.
13
14pub use metrics::*;
15
16/// Registers all metrics used by this crate.
17pub fn register_metrics() {
18 cnidarium::register_metrics();
19 penumbra_sdk_stake::component::register_metrics();
20 penumbra_sdk_funding::component::register_metrics();
21 penumbra_sdk_dex::component::register_metrics();
22 // TODO: this should be under component::
23 penumbra_sdk_governance::register_metrics();
24 penumbra_sdk_ibc::component::register_metrics();
25 penumbra_sdk_shielded_pool::component::register_metrics();
26
27 describe_counter!(
28 MEMPOOL_CHECKTX_TOTAL,
29 Unit::Count,
30 "The total number of checktx requests made to the mempool"
31 );
32}
33
34pub const MEMPOOL_CHECKTX_TOTAL: &str = "penumbra_pd_mempool_checktx_total";