feat: add reorg metrics (#3824)

This commit is contained in:
int88
2023-07-20 01:27:08 +08:00
committed by GitHub
parent 4ed7abd1a1
commit 873607502c
2 changed files with 4 additions and 1 deletions

View File

@@ -1003,6 +1003,7 @@ impl<DB: Database, C: Consensus, EF: ExecutorFactory> BlockchainTree<DB, C, EF>
};
// 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);

View File

@@ -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