Skip to content

Commit

Permalink
Merge pull request #40 from jeluard/jeluard/add-spans
Browse files Browse the repository at this point in the history
chore: add new spans
  • Loading branch information
KtorZ authored Jan 9, 2025
2 parents ec7bffb + 454a717 commit 3a36015
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions crates/amaru/src/ledger/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,37 @@ impl gasket::framework::Worker<Stage> for Worker {
) -> Result<(), WorkerError> {
match unit {
ValidateHeaderEvent::Validated(_point, raw_block) => {
let (block_header_hash, block) = parse_block(&raw_block[..]);

stage.counter.add(1, &[]);

let span_forward = info_span!(
target: EVENT_TARGET,
"forward",
header.height = block.header.header_body.block_number,
header.slot = block.header.header_body.slot,
header.hash = hex::encode(block_header_hash),
header.height = tracing::field::Empty,
header.slot = tracing::field::Empty,
header.hash = tracing::field::Empty,
stable.epoch = tracing::field::Empty,
tip.epoch = tracing::field::Empty,
tip.relative_slot = tracing::field::Empty,
)
.entered();

let span_parse_block = info_span!(
target: EVENT_TARGET,
parent: &span_forward,
"parse_block",
point = _point.slot_or_default(),
block.size = raw_block.len(),
)
.entered();

let (block_header_hash, block) = parse_block(&raw_block[..]);

span_parse_block.exit();

span_forward.record("header.height", block.header.header_body.block_number);
span_forward.record("header.slot", block.header.header_body.slot);
span_forward.record("header.hash", hex::encode(block_header_hash));

stage.counter.add(1, &[]);

let mut state = stage.state.lock().await;

state.forward(&span_forward, block).map_err(|e| {
Expand Down

0 comments on commit 3a36015

Please sign in to comment.