Beacon sync logging updates (#2930)

* Cosmetics, add some metrics updates to smoothen curves

why:
  Progress downloading blocks was just a jump from none to full

* Reclassifying some syncer gossip from TRC to DBG

why:
  Might help debugging without full trace logs
This commit is contained in:
Jordan Hrycaj 2024-12-12 17:35:10 +00:00 committed by GitHub
parent 674e65f359
commit cbc5ec9385
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 6 deletions

View File

@ -187,6 +187,9 @@ proc blocksStagedCollect*(
# response length from the network.
nBlkBlocks = blk.blocks.len
# Update, so it can be followed nicely
ctx.updateMetrics()
# Fetch and extend staging record
if not await buddy.fetchAndCheck(ivReq, blk, info):

View File

@ -25,7 +25,7 @@ import
# Private functions
# ------------------------------------------------------------------------------
func syncState(ctx: BeaconCtxRef; info: static[string]): SyncLayoutState =
proc syncState(ctx: BeaconCtxRef; info: static[string]): SyncLayoutState =
## Calculate `SyncLayoutState` from the download context
let
@ -98,7 +98,7 @@ func syncState(ctx: BeaconCtxRef; info: static[string]): SyncLayoutState =
# o---------------------o----------------o
# | <-- unprocessed --> | <-- linked --> |
#
trace info & ": inconsistent state",
debug info & ": inconsistent state",
B=(if b == c: "C" else: b.bnStr),
C=(if c == l: "L" else: c.bnStr),
L=(if l == d: "D" else: l.bnStr),
@ -121,7 +121,7 @@ proc startHibernating(ctx: BeaconCtxRef; info: static[string]) =
ctx.hibernate = true
trace info & ": suspending syncer", L=ctx.chain.latestNumber.bnStr
debug info & ": suspending syncer", L=ctx.chain.latestNumber.bnStr
# Update, so it can be followed nicely
ctx.updateMetrics()
@ -288,7 +288,7 @@ proc updateSyncState*(ctx: BeaconCtxRef; info: static[string]) =
return
# Notreached
trace info & ": sync state changed", prevState, thisState,
debug info & ": sync state changed", prevState, thisState,
L=ctx.chain.latestNumber.bnStr,
C=(if ctx.layout.coupler == ctx.layout.dangling: "D"
else: ctx.layout.coupler.bnStr),
@ -304,7 +304,7 @@ proc updateSyncState*(ctx: BeaconCtxRef; info: static[string]) =
thisState == finishedHeaders and
ctx.linkIntoFc(info): # commit downloading headers
ctx.setupProcessingBlocks info # start downloading block bodies
trace info & ": sync state changed",
debug info & ": sync state changed",
prevState=thisState, thisState=ctx.syncState(info)
return
# Notreached
@ -338,7 +338,7 @@ proc updateFinalBlockHeader*(
# Activate running (unless done yet)
if ctx.hibernate:
ctx.hibernate = false
trace info & ": activating syncer", B=b.bnStr,
debug info & ": activating syncer", B=b.bnStr,
finalised=f.bnStr, head=ctx.target.consHead.bnStr
# Update, so it can be followed nicely