fix: use a gauge for mgas_processed metric (#2353)

This commit is contained in:
Bjerg
2023-04-23 14:06:44 +02:00
committed by GitHub
parent 1026be0b64
commit e2c27073e6

View File

@@ -1,5 +1,5 @@
use crate::{ExecInput, ExecOutput, Stage, StageError, StageId, UnwindInput, UnwindOutput};
use metrics_core::Counter;
use metrics_core::Gauge;
use reth_db::{
cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO},
database::Database,
@@ -23,7 +23,7 @@ pub const EXECUTION: StageId = StageId("Execution");
#[metrics(scope = "sync.execution")]
pub struct ExecutionStageMetrics {
/// The total amount of gas processed (in millions)
mgas_processed_total: Counter,
mgas_processed_total: Gauge,
}
/// The execution stage executes all transactions and
@@ -127,7 +127,7 @@ impl<EF: ExecutorFactory> ExecutionStage<EF> {
if let Some(last_receipt) = block_state.receipts().last() {
self.metrics
.mgas_processed_total
.increment(last_receipt.cumulative_gas_used / 1_000_000);
.increment(last_receipt.cumulative_gas_used as f64 / 1_000_000.);
}
state.extend(block_state);
}