From e2c27073e6edaa4fb94159f29f423647d89fd72f Mon Sep 17 00:00:00 2001 From: Bjerg Date: Sun, 23 Apr 2023 14:06:44 +0200 Subject: [PATCH] fix: use a gauge for `mgas_processed` metric (#2353) --- crates/stages/src/stages/execution.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/stages/src/stages/execution.rs b/crates/stages/src/stages/execution.rs index 8dfb26d03d..e489a4c909 100644 --- a/crates/stages/src/stages/execution.rs +++ b/crates/stages/src/stages/execution.rs @@ -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 ExecutionStage { 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); }