Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
report only on successfull block (#6187)
Browse files Browse the repository at this point in the history
  • Loading branch information
NikVolf authored Jun 1, 2020
1 parent 9ebcda4 commit 4c29f1c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions client/basic-authorship/src/basic_authorship.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ impl<A, B, Block, C> Proposer<B, Block, C, A>
}

// proceed with transactions
let block_timer = self.metrics.report(|metrics| metrics.block_constructed.start_timer());
let block_timer = time::Instant::now();
let mut is_first = true;
let mut skipped = 0;
let mut unqueue_invalid = Vec::new();
Expand Down Expand Up @@ -295,8 +295,12 @@ impl<A, B, Block, C> Proposer<B, Block, C, A>

let (block, storage_changes, proof) = block_builder.build()?.into_inner();

drop(block_timer);
self.metrics.report(|metrics| metrics.number_of_transactions.set(block.extrinsics().len() as u64));
self.metrics.report(
|metrics| {
metrics.number_of_transactions.set(block.extrinsics().len() as u64);
metrics.block_constructed.observe(block_timer.elapsed().as_secs_f64());
}
);

info!("🎁 Prepared block for proposing at {} [hash: {:?}; parent_hash: {}; extrinsics ({}): [{}]]",
block.header().number(),
Expand Down

0 comments on commit 4c29f1c

Please sign in to comment.