penumbra_sdk_stake/component/
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    describe_gauge!(
19        MISSED_BLOCKS,
20        Unit::Count,
21        "The number of missed blocks per validator"
22    );
23}
24
25pub const MISSED_BLOCKS: &str = "penumbra_stake_missed_blocks";