reth_trie_parallel/
metrics.rsuse crate::stats::ParallelTrieStats;
use metrics::Histogram;
use reth_metrics::Metrics;
use reth_trie::metrics::{TrieRootMetrics, TrieType};
#[derive(Debug)]
pub struct ParallelStateRootMetrics {
pub state_trie: TrieRootMetrics,
pub parallel: ParallelTrieMetrics,
pub storage_trie: TrieRootMetrics,
}
impl Default for ParallelStateRootMetrics {
fn default() -> Self {
Self {
state_trie: TrieRootMetrics::new(TrieType::State),
parallel: ParallelTrieMetrics::default(),
storage_trie: TrieRootMetrics::new(TrieType::Storage),
}
}
}
impl ParallelStateRootMetrics {
pub fn record_state_trie(&self, stats: ParallelTrieStats) {
self.state_trie.record(stats.trie_stats());
self.parallel.precomputed_storage_roots.record(stats.precomputed_storage_roots() as f64);
self.parallel.missed_leaves.record(stats.missed_leaves() as f64);
}
}
#[derive(Metrics)]
#[metrics(scope = "trie_parallel")]
pub struct ParallelTrieMetrics {
pub precomputed_storage_roots: Histogram,
pub missed_leaves: Histogram,
}