Skip to content

Commit 876ef3d

Browse files
committed
improve logging
1 parent 42e71ee commit 876ef3d

File tree

1 file changed

+29
-11
lines changed

1 file changed

+29
-11
lines changed

beacon_chain/sync/column_syncer.nim

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,10 @@ proc fetchBlocksForColumnNavigation[A, B](man: ColumnManager[A, B], peer: A,
197197
direction = man.direction
198198
199199
doAssert(not(req.isEmpty()), "Request must not be empty!")
200-
debug "Requesting blocks from peer", request = req
200+
debug "Requesting blocks from peer", request = req,
201+
peer_score = req.item.getScore(),
202+
peer_speed = req.item.netKbps(),
203+
topics = "columnsync"
201204
202205
beaconBlocksByRange_v2(peer, req.slot, req.count, 1'u64)
203206
@@ -276,7 +279,10 @@ proc getDataColumnSidecars[A, B](man: ColumnManager[A, B],
276279
peer_speed = peer.netKbps()
277280
278281
doAssert(not(req.isEmpty()), "Request must not be empty")
279-
debug "Requesting data column sidecars from peer", request = req
282+
debug "Requesting data column sidecars from peer", request = req,
283+
peer_score = req.item.getScore(),
284+
peer_speed = req.item.netKbps(),
285+
topics = "columnsync"
280286
dataColumnSidecarsByRange(peer, r.slot, r.count, req_cols)
281287
282288
proc filterRelevantPeers[A, B](man: ColumnManager[A, B],
@@ -293,8 +299,11 @@ proc filterRelevantPeers[A, B](man: ColumnManager[A, B],
293299
peerSlot = peer.getHeadSlot()
294300
refreshed_peer_set: seq[A]
295301
296-
debug "Peer's syncing status", wall_clock_slot = wallSlot,
297-
remote_head_slot = peerSlot, local_head_slot = headSlot
302+
debug "Peer's syncing status", peer = peer,
303+
peer_score = peer.getScore(), peer_speed = peer.netKbps(),
304+
wall_clock_slot = wallSlot, remote_head_slot = peerSlot,
305+
local_head_slot = headSlot, direction = man.direction,
306+
topics = "columnsync"
298307
299308
let
300309
peerStatusAge = Moment.now() - peer.getStatusLastTime()
@@ -311,8 +320,12 @@ proc filterRelevantPeers[A, B](man: ColumnManager[A, B],
311320
if peerStatusAge < StatusExpirationTime div 2:
312321
await sleepAsync(StatusExpirationTime div 2 - peerStatusAge)
313322
314-
trace "Updating peer's status information", wall_clock_slot = wallSlot,
315-
remote_head_slot = peerSlot, local_head_slot = headSlot
323+
trace "Updating peer's status information",
324+
peer = peer, peer_score = peer.getScore(),
325+
peer_speed = peer.netKbps(), wall_clock_slot = wallSlot,
326+
remote_head_slot = peerSlot, local_head_slot = headSlot,
327+
direction = man.direction, topics = "columnsync"
328+
316329
317330
if not(await peer.updateStatus()):
318331
peer.updateScore(PeerScoreNoStatus)
@@ -493,7 +506,8 @@ proc columnSyncStrategyImpartial[A, B](
493506
peer = peer
494507
495508
debug "Peer's syncing status", wall_clock_slot = wallSlot,
496-
remote_head_slot = peerSlot, local_head_slot = headSlot
509+
remote_head_slot = peerSlot, local_head_slot = headSlot,
510+
direction = man.direction, topics = "columnsync"
497511
498512
let
499513
peerStatusAge = Moment.now() - peer.getStatusLastTime()
@@ -510,7 +524,8 @@ proc columnSyncStrategyImpartial[A, B](
510524
await sleepAsync(StatusExpirationTime div 2 - peerStatusAge)
511525
512526
trace "Updating peer's status information", wall_clock_slot = wallSlot,
513-
remote_head_slot = peerSlot, local_head_slot = headSlot
527+
remote_head_slot = peerSlot, local_head_slot = headSlot,
528+
direction = man.direction, topics = "columnsync"
514529
515530
if not(await peer.updateStatus()):
516531
peer.updateScore(PeerScoreNoStatus)
@@ -523,11 +538,13 @@ proc columnSyncStrategyImpartial[A, B](
523538
peer.updateScore(PeerScoreStaleStatus)
524539
debug "Peer's status information is stale",
525540
wall_clock_slot = wallSlot, remote_old_head_slot = peerSlot,
526-
local_head_slot = headSlot, remote_new_head_slot = newPeerSlot
541+
local_head_slot = headSlot, remote_new_head_slot = newPeerSlot,
542+
direction = man.direction, topics = "columnsync"
527543
else:
528544
debug "Peer's status information updated", wall_clock_slot = wallSlot,
529545
remote_old_head_slot = peerSlot, local_head_slot = headSlot,
530-
remote_new_head_slot = newPeerSlot
546+
remote_new_head_slot = newPeerSlot, direction = man.direction,
547+
topics = "columnsync"
531548
peer.updateScore(PeerScoreGoodStatus)
532549
peerSlot = newPeerSlot
533550
@@ -540,7 +557,8 @@ proc columnSyncStrategyImpartial[A, B](
540557
peer = peer
541558
542559
info "We are in sync with the network", wall_clock_slot = wallSlot,
543-
remote_head_slot = peerSlot, local_head_slot = headSlot
560+
remote_head_slot = peerSlot, local_head_slot = headSlot,
561+
direction = man.direction, topics = "columnsync"
544562
545563
# We clear ColumnManager's `notInSyncEvent` so all the workers will become
546564
# sleeping down.

0 commit comments

Comments
 (0)