Skip to content

Commit fb77ce9

Browse files
authored
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 <[email protected]>
1 parent 87ae301 commit fb77ce9

File tree

7 files changed

+24
-13
lines changed

7 files changed

+24
-13
lines changed

beacon_node/beacon_chain/src/block_verification.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2061,7 +2061,7 @@ impl BlockBlobError for GossipDataColumnError {
20612061
/// and `Cow::Borrowed(state)` will be returned. Otherwise, the state will be cloned, cheaply
20622062
/// advanced and then returned as a `Cow::Owned`. The end result is that the given `state` is never
20632063
/// mutated to be invalid (in fact, it is never changed beyond a simple committee cache build).
2064-
#[instrument(skip(state, spec), level = "debug")]
2064+
#[instrument(skip_all, fields(?state_root_opt, %block_slot), level = "debug")]
20652065
pub fn cheap_state_advance_to_obtain_committees<'a, E: EthSpec, Err: BlockBlobError>(
20662066
state: &'a mut BeaconState<E>,
20672067
state_root_opt: Option<Hash256>,

beacon_node/beacon_chain/src/data_availability_checker/overflow_lru_cache.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -666,11 +666,13 @@ impl<T: BeaconChainTypes> DataAvailabilityCheckerInner<T> {
666666
None
667667
};
668668

669-
debug!(
670-
component = "block",
671-
status = pending_components.status_str(num_expected_columns_opt),
672-
"Component added to data availability checker"
673-
);
669+
pending_components.span.in_scope(|| {
670+
debug!(
671+
component = "block",
672+
status = pending_components.status_str(num_expected_columns_opt),
673+
"Component added to data availability checker"
674+
);
675+
});
674676

675677
self.check_availability_and_cache_components(
676678
block_root,

beacon_node/network/src/network_beacon_processor/gossip_methods.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
610610
parent = None,
611611
level = "debug",
612612
skip_all,
613-
fields(slot = ?column_sidecar.slot(), block_root = ?column_sidecar.block_root(), index = column_sidecar.index),
613+
fields(slot = %column_sidecar.slot(), block_root = ?column_sidecar.block_root(), index = column_sidecar.index),
614614
)]
615615
pub async fn process_gossip_data_column_sidecar(
616616
self: &Arc<Self>,

beacon_node/network/src/sync/range_sync/batch.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use beacon_chain::block_verification_types::RpcBlock;
2+
use derivative::Derivative;
23
use lighthouse_network::PeerId;
34
use lighthouse_network::rpc::methods::BlocksByRangeRequest;
45
use lighthouse_network::service::api_types::Id;
@@ -96,7 +97,8 @@ pub enum BatchProcessingResult {
9697
NonFaultyFailure,
9798
}
9899

99-
#[derive(Debug)]
100+
#[derive(Derivative)]
101+
#[derivative(Debug)]
100102
/// A segment of a chain.
101103
pub struct BatchInfo<E: EthSpec, B: BatchConfig = RangeSyncBatchConfig> {
102104
/// Start slot of the batch.
@@ -114,6 +116,7 @@ pub struct BatchInfo<E: EthSpec, B: BatchConfig = RangeSyncBatchConfig> {
114116
/// Whether this batch contains all blocks or all blocks and blobs.
115117
batch_type: ByRangeRequestType,
116118
/// Pin the generic
119+
#[derivative(Debug = "ignore")]
117120
marker: std::marker::PhantomData<B>,
118121
}
119122

beacon_node/network/src/sync/range_sync/chain.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,14 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
131131
name = SPAN_SYNCING_CHAIN,
132132
parent = None,
133133
level="debug",
134-
skip(id),
135-
fields(chain_id = %id)
134+
skip_all,
135+
fields(
136+
chain_id = %id,
137+
start_epoch = %start_epoch,
138+
target_head_slot = %target_head_slot,
139+
target_head_root = %target_head_root,
140+
chain_type = ?chain_type,
141+
)
136142
)]
137143
pub fn new(
138144
id: Id,

beacon_node/store/src/hot_cold_store.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
10401040
/// - `result_state_root == state.canonical_root()`
10411041
/// - `state.slot() <= max_slot`
10421042
/// - `state.get_latest_block_root(result_state_root) == block_root`
1043-
#[instrument(skip(self, max_slot), level = "debug")]
1043+
#[instrument(skip_all, fields(?block_root, %max_slot, ?state_root), level = "debug")]
10441044
pub fn get_advanced_hot_state(
10451045
&self,
10461046
block_root: Hash256,
@@ -1112,7 +1112,7 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
11121112
/// If this function returns `Some(state)` then that `state` will always have
11131113
/// `latest_block_header` matching `block_root` but may not be advanced all the way through to
11141114
/// `max_slot`.
1115-
#[instrument(skip(self), level = "debug")]
1115+
#[instrument(skip_all, fields(?block_root, %max_slot), level = "debug")]
11161116
pub fn get_advanced_hot_state_from_cache(
11171117
&self,
11181118
block_root: Hash256,

beacon_node/store/src/state_cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ impl<E: EthSpec> StateCache<E> {
299299
None
300300
}
301301

302-
#[instrument(skip(self), level = "debug")]
302+
#[instrument(skip_all, fields(?block_root, %slot), level = "debug")]
303303
pub fn get_by_block_root(
304304
&mut self,
305305
block_root: Hash256,

0 commit comments

Comments
 (0)