Add missing event in PendingComponent span and clean up sync logs (#8033)

I was looking into some long `PendingComponents` span and noticed the block event wasn't added to the span, so it wasn't possible to see when the block was added from the trace view, this PR fixes this.

<img width="637" height="430" alt="image" src="https://github.com/user-attachments/assets/65040b1c-11e7-43ac-951b-bdfb34b665fb" />

Additionally I've noticed a lot of noises and confusion in sync logs due to the initial`peer_id` being included as part of the syncing chain span, causing all logs under the span to have that `peer_id`, which may not be accurate for some sync logs, I've removed `peer_id` from the `SyncingChain` span, and also cleaned up a bunch of spans to use `%` (display) for slots and epochs to make logs easier to read.


  


Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
This commit is contained in:
Jimmy Chen
2025-09-12 15:11:30 +10:00
committed by GitHub
parent 87ae301d09
commit fb77ce9e19
7 changed files with 24 additions and 13 deletions

View File

@@ -1040,7 +1040,7 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
/// - `result_state_root == state.canonical_root()`
/// - `state.slot() <= max_slot`
/// - `state.get_latest_block_root(result_state_root) == block_root`
#[instrument(skip(self, max_slot), level = "debug")]
#[instrument(skip_all, fields(?block_root, %max_slot, ?state_root), level = "debug")]
pub fn get_advanced_hot_state(
&self,
block_root: Hash256,
@@ -1112,7 +1112,7 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
/// If this function returns `Some(state)` then that `state` will always have
/// `latest_block_header` matching `block_root` but may not be advanced all the way through to
/// `max_slot`.
#[instrument(skip(self), level = "debug")]
#[instrument(skip_all, fields(?block_root, %max_slot), level = "debug")]
pub fn get_advanced_hot_state_from_cache(
&self,
block_root: Hash256,

View File

@@ -299,7 +299,7 @@ impl<E: EthSpec> StateCache<E> {
None
}
#[instrument(skip(self), level = "debug")]
#[instrument(skip_all, fields(?block_root, %slot), level = "debug")]
pub fn get_by_block_root(
&mut self,
block_root: Hash256,