Skip to content

Commit 6d68edd

Browse files
committed
record metrics on cancel
1 parent 11410f6 commit 6d68edd

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

crates/op-rbuilder/src/payload_builder.rs

+10-6
Original file line numberDiff line numberDiff line change
@@ -1157,6 +1157,7 @@ where
11571157

11581158
// check if the job was cancelled, if so we can exit early
11591159
if self.cancel.is_cancelled() {
1160+
self.record_tx_metrics(num_txs_considered, num_txs_simulated, num_txs_simulated_success, num_txs_simulated_fail);
11601161
return Ok(Some(()));
11611162
}
11621163

@@ -1224,20 +1225,23 @@ where
12241225
info.executed_senders.push(tx.signer());
12251226
info.executed_transactions.push(tx.into_inner());
12261227
}
1228+
self.record_tx_metrics(num_txs_considered, num_txs_simulated, num_txs_simulated_success, num_txs_simulated_fail);
1229+
Ok(None)
1230+
}
12271231

1232+
/// Record transaction metrics for payload building
1233+
fn record_tx_metrics(&self, considered: usize, simulated: usize, success: usize, fail: usize) {
12281234
self.metrics
12291235
.payload_num_tx_considered
1230-
.record(num_txs_considered as f64);
1236+
.record(considered as f64);
12311237
self.metrics
12321238
.payload_num_tx_simulated
1233-
.record(num_txs_simulated as f64);
1239+
.record(simulated as f64);
12341240
self.metrics
12351241
.payload_num_tx_simulated_success
1236-
.record(num_txs_simulated_success as f64);
1242+
.record(success as f64);
12371243
self.metrics
12381244
.payload_num_tx_simulated_fail
1239-
.record(num_txs_simulated_fail as f64);
1240-
1241-
Ok(None)
1245+
.record(fail as f64);
12421246
}
12431247
}

0 commit comments

Comments
 (0)