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. # response length from the network.
nBlkBlocks = blk.blocks.len nBlkBlocks = blk.blocks.len
# Update, so it can be followed nicely
ctx.updateMetrics()
# Fetch and extend staging record # Fetch and extend staging record
if not await buddy.fetchAndCheck(ivReq, blk, info): if not await buddy.fetchAndCheck(ivReq, blk, info):

View File

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