mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
This commit is contained in:
@ -45,8 +45,7 @@ pub enum MetricEvent {
|
||||
#[derive(Debug)]
|
||||
pub struct MetricsListener {
|
||||
events_rx: UnboundedReceiver<MetricEvent>,
|
||||
/// underline metrics of stages
|
||||
pub sync_metrics: SyncMetrics,
|
||||
pub(crate) sync_metrics: SyncMetrics,
|
||||
}
|
||||
|
||||
impl MetricsListener {
|
||||
|
||||
@ -6,14 +6,14 @@ use reth_primitives::stage::StageId;
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct SyncMetrics {
|
||||
pub stages: HashMap<StageId, StageMetrics>,
|
||||
pub execution_stage: ExecutionStageMetrics,
|
||||
pub(crate) struct SyncMetrics {
|
||||
pub(crate) stages: HashMap<StageId, StageMetrics>,
|
||||
pub(crate) execution_stage: ExecutionStageMetrics,
|
||||
}
|
||||
|
||||
impl SyncMetrics {
|
||||
/// Returns existing or initializes a new instance of [StageMetrics] for the provided [StageId].
|
||||
pub fn get_stage_metrics(&mut self, stage_id: StageId) -> &mut StageMetrics {
|
||||
pub(crate) fn get_stage_metrics(&mut self, stage_id: StageId) -> &mut StageMetrics {
|
||||
self.stages
|
||||
.entry(stage_id)
|
||||
.or_insert_with(|| StageMetrics::new_with_labels(&[("stage", stage_id.to_string())]))
|
||||
@ -22,19 +22,19 @@ impl SyncMetrics {
|
||||
|
||||
#[derive(Metrics)]
|
||||
#[metrics(scope = "sync")]
|
||||
pub struct StageMetrics {
|
||||
pub(crate) struct StageMetrics {
|
||||
/// The block number of the last commit for a stage.
|
||||
pub checkpoint: Gauge,
|
||||
pub(crate) checkpoint: Gauge,
|
||||
/// The number of processed entities of the last commit for a stage, if applicable.
|
||||
pub entities_processed: Gauge,
|
||||
pub(crate) entities_processed: Gauge,
|
||||
/// The number of total entities of the last commit for a stage, if applicable.
|
||||
pub entities_total: Gauge,
|
||||
pub(crate) entities_total: Gauge,
|
||||
}
|
||||
|
||||
/// Execution stage metrics.
|
||||
#[derive(Metrics)]
|
||||
#[metrics(scope = "sync.execution")]
|
||||
pub struct ExecutionStageMetrics {
|
||||
pub(crate) struct ExecutionStageMetrics {
|
||||
/// The total amount of gas processed (in millions)
|
||||
pub mgas_processed_total: Counter,
|
||||
pub(crate) mgas_processed_total: Counter,
|
||||
}
|
||||
|
||||
@ -21,16 +21,9 @@ use tokio::sync::watch;
|
||||
use tokio_stream::wrappers::UnboundedReceiverStream;
|
||||
use tracing::*;
|
||||
|
||||
// (todo) remove it
|
||||
#[allow(missing_docs)]
|
||||
pub mod builder;
|
||||
|
||||
// (todo) remove it
|
||||
#[allow(missing_docs)]
|
||||
pub mod progress;
|
||||
// (todo) remove it
|
||||
#[allow(missing_docs)]
|
||||
pub mod set;
|
||||
mod builder;
|
||||
mod progress;
|
||||
mod set;
|
||||
|
||||
use crate::{
|
||||
BlockErrorKind, ExecInput, ExecOutput, MetricEvent, MetricEventsSender, PipelineError, Stage,
|
||||
|
||||
@ -2,13 +2,13 @@ use crate::{util::opt, ControlFlow};
|
||||
use reth_primitives::BlockNumber;
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct PipelineProgress {
|
||||
pub(crate) struct PipelineProgress {
|
||||
/// Block number reached by the stage.
|
||||
pub block_number: Option<BlockNumber>,
|
||||
pub(crate) block_number: Option<BlockNumber>,
|
||||
/// The maximum block number achieved by any stage during the execution of the pipeline.
|
||||
pub maximum_block_number: Option<BlockNumber>,
|
||||
pub(crate) maximum_block_number: Option<BlockNumber>,
|
||||
/// The minimum block number achieved by any stage during the execution of the pipeline.
|
||||
pub minimum_block_number: Option<BlockNumber>,
|
||||
pub(crate) minimum_block_number: Option<BlockNumber>,
|
||||
}
|
||||
|
||||
impl PipelineProgress {
|
||||
|
||||
Reference in New Issue
Block a user