Skip to content

Commit

Permalink
feat(mock-consensus): ➰ record height in inner span
Browse files Browse the repository at this point in the history
this tweaks the fast-forward facilities (#3933, #4002) so that we record
the height as a span field per-loop iteration, not as a field in the
encompassing `#[instrument]` span.

see #4005 for an example of the misleading `height: 0` logs this would
generate.
  • Loading branch information
cratelyn committed Mar 15, 2024
1 parent c5118f1 commit 4002dff
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions crates/test/mock-consensus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,19 @@ where
/// Fast forwards a number of blocks.
#[tracing::instrument(
skip(self),
fields(
height = %self.height,
fast_forward.blocks = %blocks,
)
fields(fast_forward.blocks = %blocks)
)]
pub async fn fast_forward(&mut self, blocks: usize) -> anyhow::Result<()> {
use {
tap::Tap,
tracing::{info, trace},
tracing::{info, trace, trace_span, Instrument},
};

for i in 0..blocks {
self.block()
.execute()
.tap(|_| trace!(%i, "executing empty block"))
.instrument(trace_span!("executing empty block", %i))
.await
.tap(|_| trace!(%i, "finished executing empty block"))?;
}
Expand Down

0 comments on commit 4002dff

Please sign in to comment.