mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-30 03:01:58 -04:00
feat: add metrics for safe and finalized block heights (#18987)
This commit is contained in:
@@ -122,6 +122,10 @@ pub(crate) struct TreeMetrics {
|
||||
pub reorgs: Counter,
|
||||
/// The latest reorg depth
|
||||
pub latest_reorg_depth: Gauge,
|
||||
/// The current safe block height (this is required by optimism)
|
||||
pub safe_block_height: Gauge,
|
||||
/// The current finalized block height (this is required by optimism)
|
||||
pub finalized_block_height: Gauge,
|
||||
}
|
||||
|
||||
/// Metrics for the `EngineApi`.
|
||||
|
||||
@@ -2805,7 +2805,9 @@ where
|
||||
// we're also persisting the finalized block on disk so we can reload it on
|
||||
// restart this is required by optimism which queries the finalized block: <https://github.com/ethereum-optimism/optimism/blob/c383eb880f307caa3ca41010ec10f30f08396b2e/op-node/rollup/sync/start.go#L65-L65>
|
||||
let _ = self.persistence.save_finalized_block_number(finalized.number());
|
||||
self.canonical_in_memory_state.set_finalized(finalized);
|
||||
self.canonical_in_memory_state.set_finalized(finalized.clone());
|
||||
// Update finalized block height metric
|
||||
self.metrics.tree.finalized_block_height.set(finalized.number() as f64);
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
@@ -2833,7 +2835,9 @@ where
|
||||
// we're also persisting the safe block on disk so we can reload it on
|
||||
// restart this is required by optimism which queries the safe block: <https://github.com/ethereum-optimism/optimism/blob/c383eb880f307caa3ca41010ec10f30f08396b2e/op-node/rollup/sync/start.go#L65-L65>
|
||||
let _ = self.persistence.save_safe_block_number(safe.number());
|
||||
self.canonical_in_memory_state.set_safe(safe);
|
||||
self.canonical_in_memory_state.set_safe(safe.clone());
|
||||
// Update safe block height metric
|
||||
self.metrics.tree.safe_block_height.set(safe.number() as f64);
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
|
||||
Reference in New Issue
Block a user