diff --git a/crates/blockchain-tree/src/blockchain_tree.rs b/crates/blockchain-tree/src/blockchain_tree.rs index 819d60d4c3..6c5f2fe3d6 100644 --- a/crates/blockchain-tree/src/blockchain_tree.rs +++ b/crates/blockchain-tree/src/blockchain_tree.rs @@ -1003,6 +1003,7 @@ impl BlockchainTree }; // insert old canon chain self.insert_chain(AppendableChain::new(old_canon_chain)); + self.metrics.reorgs.increment(1); } else { // error here to confirm that we are reverting nothing from db. error!(target: "blockchain_tree", "Reverting nothing from db on block: #{:?}", block_hash); diff --git a/crates/blockchain-tree/src/metrics.rs b/crates/blockchain-tree/src/metrics.rs index 38610c5a69..864fac9474 100644 --- a/crates/blockchain-tree/src/metrics.rs +++ b/crates/blockchain-tree/src/metrics.rs @@ -1,5 +1,5 @@ use reth_metrics::{ - metrics::{self, Gauge}, + metrics::{self, Counter, Gauge}, Metrics, }; @@ -11,6 +11,8 @@ pub struct TreeMetrics { pub sidechains: Gauge, /// The highest block number in the canonical chain pub canonical_chain_height: Gauge, + /// The number of reorgs + pub reorgs: Counter, } /// Metrics for the blockchain tree block buffer