diff --git a/crates/consensus/beacon/src/engine/metrics.rs b/crates/consensus/beacon/src/engine/metrics.rs new file mode 100644 index 0000000000..8305d422ca --- /dev/null +++ b/crates/consensus/beacon/src/engine/metrics.rs @@ -0,0 +1,14 @@ +use metrics::Counter; +use reth_metrics_derive::Metrics; + +/// Beacon consensus engine metrics. +#[derive(Metrics)] +#[metrics(scope = "consensus.engine.beacon")] +pub(crate) struct Metrics { + /// The number of times the pipeline was run. + pub(crate) pipeline_runs: Counter, + /// The total count of forkchoice updated messages received. + pub(crate) forkchoice_updated_messages: Counter, + /// The total count of new payload messages received. + pub(crate) new_payload_messages: Counter, +} diff --git a/crates/consensus/beacon/src/engine/mod.rs b/crates/consensus/beacon/src/engine/mod.rs index 1813b31ad8..e43d775806 100644 --- a/crates/consensus/beacon/src/engine/mod.rs +++ b/crates/consensus/beacon/src/engine/mod.rs @@ -1,5 +1,5 @@ +use crate::engine::metrics::Metrics; use futures::{Future, FutureExt, StreamExt}; -use metrics::Counter; use reth_db::{database::Database, tables, transaction::DbTx}; use reth_interfaces::{ blockchain_tree::{BlockStatus, BlockchainTreeEngine}, @@ -8,7 +8,6 @@ use reth_interfaces::{ sync::SyncStateUpdater, Error, }; -use reth_metrics_derive::Metrics; use reth_payload_builder::{PayloadBuilderAttributes, PayloadBuilderHandle}; use reth_primitives::{BlockNumber, Header, SealedBlock, H256}; use reth_rpc_types::engine::{ @@ -32,21 +31,10 @@ pub use error::{BeaconEngineError, BeaconEngineResult}; mod message; pub use message::BeaconEngineMessage; +mod metrics; mod pipeline_state; pub use pipeline_state::PipelineState; -/// Beacon consensus engine metrics. -#[derive(Metrics)] -#[metrics(scope = "consensus.engine.beacon")] -struct Metrics { - /// The number of times the pipeline was run. - pipeline_runs: Counter, - /// The total count of forkchoice updated messages received. - forkchoice_updated_messages: Counter, - /// The total count of new payload messages received. - new_payload_messages: Counter, -} - /// The beacon consensus engine is the driver that switches between historical and live sync. /// /// The beacon consensus engine is itself driven by messages from the Consensus Layer, which are