reth_node_metrics/
chain.rs

1//! This exposes reth's chain information over prometheus.
2use metrics::{describe_gauge, gauge};
3
4/// Contains chain information for the application.
5#[derive(Debug, Clone)]
6pub struct ChainSpecInfo {
7    /// The name of the chain.
8    pub name: String,
9}
10
11impl ChainSpecInfo {
12    /// This exposes reth's chain information over prometheus.
13    pub fn register_chain_spec_metrics(&self) {
14        let labels: [(&str, String); 1] = [("name", self.name.clone())];
15
16        describe_gauge!("chain_spec", "Information about the chain");
17        let _gauge = gauge!("chain_spec", &labels);
18    }
19}