Skip to content

Commit 014473a

Browse files
committed
feat: add reverted_tx_count counter metric
1 parent 79c66e9 commit 014473a

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

crates/op-rbuilder/src/builder/context.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,7 @@ impl OpPayloadJobCtx {
513513
num_txs_simulated_fail += 1;
514514
reverted_gas_used += gas_used;
515515
self.metrics.reverted_tx_gas_used.record(gas_used as f64);
516+
self.metrics.reverted_tx_count.increment(1);
516517
if is_bundle_tx {
517518
num_bundles_reverted += 1;
518519
}
@@ -763,6 +764,7 @@ impl OpPayloadJobCtx {
763764
num_bundles_reverted += 1;
764765
reverted_gas_used += br_gas_used;
765766
self.metrics.reverted_tx_gas_used.record(br_gas_used as f64);
767+
self.metrics.reverted_tx_count.increment(1);
766768
log_br_txn(TxnExecutionResult::RevertedAndExcluded);
767769
continue;
768770
}

crates/op-rbuilder/src/metrics.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ pub struct OpRBuilderMetrics {
137137
pub successful_tx_gas_used: Histogram,
138138
/// Histogram of gas used by reverted transactions
139139
pub reverted_tx_gas_used: Histogram,
140+
/// Cumulative count of reverted transactions observed during payload building.
141+
/// Use `rate(op_rbuilder_reverted_tx_count[1m])` instead of the per-tx trace log.
142+
pub reverted_tx_count: Counter,
140143
/// Gas used by reverted transactions in the latest block
141144
pub payload_reverted_tx_gas_used: Gauge,
142145
/// Histogram of tx simulation duration

0 commit comments

Comments
 (0)