chore(stages/metrics): use Counter instead of Gauge for mgas_processed (#7234)

Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
Delweng
2024-03-25 03:37:51 +08:00
committed by GitHub
parent 7efd5b09d2
commit 7e6d61a66a
2 changed files with 8 additions and 7 deletions

View File

@ -85,11 +85,9 @@ impl MetricsListener {
stage_metrics.entities_total.set(total as f64); stage_metrics.entities_total.set(total as f64);
} }
} }
MetricEvent::ExecutionStageGas { gas } => self MetricEvent::ExecutionStageGas { gas } => {
.sync_metrics self.sync_metrics.execution_stage.mgas_processed_total.increment(gas / MGAS_TO_GAS)
.execution_stage }
.mgas_processed_total
.increment(gas as f64 / MGAS_TO_GAS as f64),
} }
} }
} }

View File

@ -1,4 +1,7 @@
use reth_metrics::{metrics::Gauge, Metrics}; use reth_metrics::{
metrics::{Counter, Gauge},
Metrics,
};
use reth_primitives::stage::StageId; use reth_primitives::stage::StageId;
use std::collections::HashMap; use std::collections::HashMap;
@ -33,5 +36,5 @@ pub(crate) struct StageMetrics {
#[metrics(scope = "sync.execution")] #[metrics(scope = "sync.execution")]
pub(crate) struct ExecutionStageMetrics { pub(crate) struct ExecutionStageMetrics {
/// The total amount of gas processed (in millions) /// The total amount of gas processed (in millions)
pub(crate) mgas_processed_total: Gauge, pub(crate) mgas_processed_total: Counter,
} }