Improve tx tracer timing of inclusion metrics#732
Conversation
🟡 Heimdall Review Status
|
7bc3047 to
4487886
Compare
| } | ||
|
|
||
| fn track_committed_chain<N: NodePrimitives>(&mut self, chain: &Chain<N>) { | ||
| let received_at = Instant::now(); |
There was a problem hiding this comment.
The PR goal is to capture the timestamp when the block/flashblock notification is received from the stream, not when the tracker processes it. But Instant::now() is called here inside track_committed_chain, which runs after handle_canon_state_notification dispatches to it. Consider capturing the timestamp in the public entry points (handle_canon_state_notification / handle_flashblock_notification) or even in the tokio::select! branch in tracex_subscription before any processing occurs. As written, this still includes processing overhead from the handle_* method call chain (minor), and the name received_at is slightly misleading — it's really "processing started at."
The same applies to track_flashblock_transactions at line 95.
This is a minor point since the delta is small in practice, but if accuracy of the "received" timestamp matters (as the PR title suggests), hoisting it to the tokio::select! arms in subscription.rs would be more precise:
// in tracex_subscription
Some(Ok(notification)) = canonical_stream.next() => {
let received_at = Instant::now();
tracker.handle_canon_state_notification(notification, received_at);
}4487886 to
32b66c2
Compare
Review SummaryClean, well-scoped change. The PR correctly captures The change is appropriately limited to block/flashblock inclusion paths. Mempool pool-movement events ( No correctness, safety, or performance concerns found. Note on the existing inline comment: The prior bot comment on |
Small Improvement to the accuracy of tx inclusion metrics emitted from txpool tracer, by capturing the timestamp a block or flashblock was received, rather than when the tx was processed by the tracer.