From de32d3d3ab7c5f380fd4cb6b4718296f921363c1 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Wed, 2 Oct 2024 09:20:48 +0200 Subject: [PATCH] chore: add metric and trace for already executed blocks --- crates/engine/tree/src/tree/metrics.rs | 2 ++ crates/engine/tree/src/tree/mod.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/crates/engine/tree/src/tree/metrics.rs b/crates/engine/tree/src/tree/metrics.rs index 922041ae7151..52dbf34173df 100644 --- a/crates/engine/tree/src/tree/metrics.rs +++ b/crates/engine/tree/src/tree/metrics.rs @@ -24,6 +24,8 @@ pub(crate) struct EngineApiMetrics { pub(crate) struct EngineMetrics { /// How many executed blocks are currently stored. pub(crate) executed_blocks: Gauge, + /// How many already executed blocks were directly inserted into the tree. + pub(crate) inserted_already_executed_blocks: Counter, /// The number of times the pipeline was run. pub(crate) pipeline_runs: Counter, /// The total count of forkchoice updated messages received. diff --git a/crates/engine/tree/src/tree/mod.rs b/crates/engine/tree/src/tree/mod.rs index 1c79fa3ef88f..689fd43f634b 100644 --- a/crates/engine/tree/src/tree/mod.rs +++ b/crates/engine/tree/src/tree/mod.rs @@ -1191,7 +1191,9 @@ where FromEngine::Request(request) => { match request { EngineApiRequest::InsertExecutedBlock(block) => { + debug!(target: "engine::tree", block=?block.block().num_hash(), "inserting already executed block"); self.state.tree_state.insert_executed(block); + self.metrics.engine.inserted_already_executed_blocks.increment(1); } EngineApiRequest::Beacon(request) => { match request {