Skip to content

Commit f744ad6

Browse files
authored
feat(engine): more engine execution tracing spans (#20135)
1 parent cfde951 commit f744ad6

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

crates/engine/tree/src/tree/metrics.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ impl EngineApiMetrics {
7979
let mut executor = executor.with_state_hook(Some(Box::new(wrapper)));
8080

8181
let f = || {
82-
executor.apply_pre_execution_changes()?;
82+
debug_span!(target: "engine::tree", "pre execution")
83+
.entered()
84+
.in_scope(|| executor.apply_pre_execution_changes())?;
85+
let exec_span = debug_span!(target: "engine::tree", "execution").entered();
8386
for tx in transactions {
8487
let tx = tx?;
8588
let span =
@@ -92,7 +95,11 @@ impl EngineApiMetrics {
9295
// record the tx gas used
9396
enter.record("gas_used", gas_used);
9497
}
95-
executor.finish().map(|(evm, result)| (evm.into_db(), result))
98+
drop(exec_span);
99+
debug_span!(target: "engine::tree", "finish")
100+
.entered()
101+
.in_scope(|| executor.finish())
102+
.map(|(evm, result)| (evm.into_db(), result))
96103
};
97104

98105
// Use metered to execute and track timing/gas metrics
@@ -103,7 +110,9 @@ impl EngineApiMetrics {
103110
})?;
104111

105112
// merge transitions into bundle state
106-
db.borrow_mut().merge_transitions(BundleRetention::Reverts);
113+
debug_span!(target: "engine::tree", "merge transitions")
114+
.entered()
115+
.in_scope(|| db.borrow_mut().merge_transitions(BundleRetention::Reverts));
107116
let output = BlockExecutionOutput { result, state: db.borrow_mut().take_bundle() };
108117

109118
// Update the metrics for the number of accounts, storage slots and bytecodes updated

0 commit comments

Comments
 (0)