Skip to main content

reth_trie_parallel/proof_task/
metrics.rs

1//! Proof worker metrics.
2
3use reth_metrics::{metrics::Histogram, Metrics};
4use std::time::Duration;
5
6/// Idle time metrics of the proof workers.
7#[derive(Clone, Metrics)]
8#[metrics(scope = "trie.proof_task")]
9pub struct ProofWorkerIdleMetrics {
10    /// Histogram for storage worker idle time in seconds (waiting for proof jobs).
11    storage_worker_idle_time_seconds: Histogram,
12    /// Histogram for account worker idle time in seconds (waiting for proof jobs).
13    account_worker_idle_time_seconds: Histogram,
14}
15
16impl ProofWorkerIdleMetrics {
17    /// Record storage worker idle time.
18    pub fn record_storage_worker_idle_time(&self, duration: Duration) {
19        self.storage_worker_idle_time_seconds.record(duration.as_secs_f64());
20    }
21
22    /// Record account worker idle time.
23    pub fn record_account_worker_idle_time(&self, duration: Duration) {
24        self.account_worker_idle_time_seconds.record(duration.as_secs_f64());
25    }
26}