state: shorten tracing messages
Make tracing messages more concise by omitting information already contained in a parent span and by shortening messages. This makes them easier to read.
This commit is contained in:
parent
3192a5008d
commit
719a48ad9e
|
|
@ -35,12 +35,10 @@ impl Chain {
|
||||||
let block_height = block
|
let block_height = block
|
||||||
.coinbase_height()
|
.coinbase_height()
|
||||||
.expect("valid non-finalized blocks have a coinbase height");
|
.expect("valid non-finalized blocks have a coinbase height");
|
||||||
|
|
||||||
trace!(?block_height, "Pushing new block into chain state");
|
|
||||||
|
|
||||||
// update cumulative data members
|
// update cumulative data members
|
||||||
self.update_chain_state_with(&block);
|
self.update_chain_state_with(&block);
|
||||||
self.blocks.insert(block_height, block);
|
self.blocks.insert(block_height, block);
|
||||||
|
trace!("pushed block onto chain");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Remove the lowest height block of the non-finalized portion of a chain.
|
/// Remove the lowest height block of the non-finalized portion of a chain.
|
||||||
|
|
|
||||||
|
|
@ -48,17 +48,17 @@ impl QueuedBlocks {
|
||||||
.insert(new_hash);
|
.insert(new_hash);
|
||||||
assert!(inserted, "hashes must be unique");
|
assert!(inserted, "hashes must be unique");
|
||||||
|
|
||||||
tracing::trace!(num_blocks = %self.blocks.len(), %parent_hash, ?new_height, "Finished queueing a new block");
|
tracing::trace!(%parent_hash, queued = %self.blocks.len(), "queued block");
|
||||||
self.update_metrics();
|
self.update_metrics();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Dequeue and return all blocks that were waiting for the arrival of
|
/// Dequeue and return all blocks that were waiting for the arrival of
|
||||||
/// `parent`.
|
/// `parent`.
|
||||||
#[instrument(skip(self))]
|
#[instrument(skip(self), fields(%parent_hash))]
|
||||||
pub fn dequeue_children(&mut self, parent: block::Hash) -> Vec<QueuedBlock> {
|
pub fn dequeue_children(&mut self, parent_hash: block::Hash) -> Vec<QueuedBlock> {
|
||||||
let queued_children = self
|
let queued_children = self
|
||||||
.by_parent
|
.by_parent
|
||||||
.remove(&parent)
|
.remove(&parent_hash)
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|hash| {
|
.map(|hash| {
|
||||||
|
|
@ -73,7 +73,11 @@ impl QueuedBlocks {
|
||||||
self.by_height.remove(&height);
|
self.by_height.remove(&height);
|
||||||
}
|
}
|
||||||
|
|
||||||
tracing::trace!(num_blocks = %self.blocks.len(), "Finished dequeuing blocks waiting for parent hash",);
|
tracing::trace!(
|
||||||
|
dequeued = queued_children.len(),
|
||||||
|
remaining = self.blocks.len(),
|
||||||
|
"dequeued blocks"
|
||||||
|
);
|
||||||
self.update_metrics();
|
self.update_metrics();
|
||||||
|
|
||||||
queued_children
|
queued_children
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue