Skip to content

Commit 0ba29ef

Browse files
committed
log(ledger): add block height to traces
1 parent be6a430 commit 0ba29ef

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

ledger/block/src/verify.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use rayon::prelude::*;
2727

2828
impl<N: Network> Block<N> {
2929
/// Ensures the block is correct.
30-
#[cfg_attr(feature = "instrumentation", tracing::instrument(skip_all))]
30+
#[cfg_attr(feature = "instrumentation", tracing::instrument(skip_all, fields(height=self.height())))]
3131
pub fn verify(
3232
&self,
3333
previous_block: &Block<N>,

ledger/src/advance.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl<N: Network, C: ConsensusStorage<N>> Ledger<N, C> {
101101
///
102102
/// # Panics
103103
/// This function panics if called from an async context.
104-
#[cfg_attr(feature = "instrumentation", tracing::instrument(skip_all))]
104+
#[cfg_attr(feature = "instrumentation", tracing::instrument(skip_all, fields(height=block.height())))]
105105
pub fn advance_to_next_block(&self, block: &Block<N>) -> Result<()> {
106106
// Acquire the write lock on the current block.
107107
let mut current_block = self.current_block.write();

ledger/src/check_next_block.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl<N: Network, C: ConsensusStorage<N>> Ledger<N, C> {
2424
///
2525
/// # Panics
2626
/// This function panics if called from an async context.
27-
#[cfg_attr(feature = "instrumentation", tracing::instrument(skip_all))]
27+
#[cfg_attr(feature = "instrumentation", tracing::instrument(skip_all, fields(height=block.height())))]
2828
pub fn check_next_block<R: CryptoRng + Rng>(&self, block: &Block<N>, rng: &mut R) -> Result<()> {
2929
let height = block.height();
3030
let latest_block = self.latest_block();
@@ -146,7 +146,7 @@ impl<N: Network, C: ConsensusStorage<N>> Ledger<N, C> {
146146
///
147147
/// This does not verify that the batches are signed correctly or that the edges are valid
148148
/// (only point to the previous round), as those checks already happened when the node received the batch.
149-
#[cfg_attr(feature = "instrumentation", tracing::instrument(skip_all))]
149+
#[cfg_attr(feature = "instrumentation", tracing::instrument(skip_all, fields(height=block.height())))]
150150
fn check_block_subdag_leaves(&self, block: &Block<N>) -> Result<()> {
151151
// Check if the block has a subdag.
152152
let Authority::Quorum(subdag) = block.authority() else {
@@ -188,7 +188,7 @@ impl<N: Network, C: ConsensusStorage<N>> Ledger<N, C> {
188188
/// Check that the certificates in the block subdag have met quorum requirements.
189189
///
190190
/// Called by [`Self::check_block_subdag`]
191-
#[cfg_attr(feature = "instrumentation", tracing::instrument(skip_all))]
191+
#[cfg_attr(feature = "instrumentation", tracing::instrument(skip_all, fields(height=block.height())))]
192192
fn check_block_subdag_quorum(&self, block: &Block<N>) -> Result<()> {
193193
// Check if the block has a subdag.
194194
let subdag = match block.authority() {

0 commit comments

Comments
 (0)