feat(rpc/validation): Expose metric for validation disallow list size. (#14057)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Ryan Schneider
2025-01-29 01:50:26 -08:00
committed by GitHub
parent dac2085d46
commit c7152ee9fa
3 changed files with 15 additions and 0 deletions

1
Cargo.lock generated
View File

@ -8748,6 +8748,7 @@ dependencies = [
"reth-errors",
"reth-evm",
"reth-evm-ethereum",
"reth-metrics",
"reth-network-api",
"reth-network-peers",
"reth-network-types",

View File

@ -20,6 +20,7 @@ reth-rpc-api.workspace = true
reth-rpc-eth-api.workspace = true
reth-engine-primitives.workspace = true
reth-errors.workspace = true
reth-metrics.workspace = true
reth-provider.workspace = true
reth-transaction-pool.workspace = true
reth-network-api.workspace = true

View File

@ -17,6 +17,7 @@ use reth_consensus::{Consensus, FullConsensus, PostExecutionInput};
use reth_engine_primitives::PayloadValidator;
use reth_errors::{BlockExecutionError, ConsensusError, ProviderError};
use reth_evm::execute::{BlockExecutorProvider, Executor};
use reth_metrics::{metrics, metrics::Gauge, Metrics};
use reth_primitives::{GotExpected, NodePrimitives, RecoveredBlock, SealedHeader};
use reth_primitives_traits::{constants::GAS_LIMIT_BOUND_DIVISOR, BlockBody, SealedBlock};
use reth_provider::{BlockExecutionOutput, BlockReaderIdExt, StateProviderFactory};
@ -62,8 +63,10 @@ where
validation_window,
cached_state: Default::default(),
task_spawner,
metrics: Default::default(),
});
inner.metrics.disallow_size.set(inner.disallow.len() as f64);
Self { inner }
}
@ -478,6 +481,8 @@ pub struct ValidationApiInner<Provider, E: BlockExecutorProvider> {
cached_state: RwLock<(B256, CachedReads)>,
/// Task spawner for blocking operations
task_spawner: Box<dyn TaskSpawner>,
/// Validation metrics
metrics: ValidationMetrics,
}
/// Configuration for validation API.
@ -537,3 +542,11 @@ pub enum ValidationApiError {
#[error(transparent)]
Payload(#[from] PayloadError),
}
/// Metrics for the validation endpoint.
#[derive(Metrics)]
#[metrics(scope = "builder.validation")]
pub(crate) struct ValidationMetrics {
/// The number of entries configured in the builder validation disallow list.
pub(crate) disallow_size: Gauge,
}