pd/
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
14#[allow(unused_imports)] // It is okay if this reƫxport isn't used, see above.
15pub use metrics::*;
16
17pub mod cpu_worker;
18pub mod sleep_worker;
19
20/// Registers all metrics used by this crate.
21///
22/// For this implementation, in the `pd` crate, we also call the `register_metrics()`
23/// functions in our dependencies.
24pub fn register_metrics() {
25    // This will register metrics for all components.
26    penumbra_sdk_app::register_metrics();
27    self::sleep_worker::register_metrics();
28    self::cpu_worker::register_metrics();
29}