Skip to content

Commit 074f0a6

Browse files
committed
record metrics on cancel
1 parent 11410f6 commit 074f0a6

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

crates/op-rbuilder/src/payload_builder.rs

+9-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,22 @@ 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+
fn record_tx_metrics(&self, considered: usize, simulated: usize, success: usize, fail: usize) {
12281233
self.metrics
12291234
.payload_num_tx_considered
1230-
.record(num_txs_considered as f64);
1235+
.record(considered as f64);
12311236
self.metrics
12321237
.payload_num_tx_simulated
1233-
.record(num_txs_simulated as f64);
1238+
.record(simulated as f64);
12341239
self.metrics
12351240
.payload_num_tx_simulated_success
1236-
.record(num_txs_simulated_success as f64);
1241+
.record(success as f64);
12371242
self.metrics
12381243
.payload_num_tx_simulated_fail
1239-
.record(num_txs_simulated_fail as f64);
1240-
1241-
Ok(None)
1244+
.record(fail as f64);
12421245
}
12431246
}

0 commit comments

Comments
 (0)