metrics for proposer and sync duties (#6028)
To avoid restarting with scheduled proposals or sync duties, which are rare but have high rewards, add metrics to simpify tracking them.
This commit is contained in:
parent
e6253c0793
commit
3b4b1ccb89
|
@ -51,6 +51,12 @@ declareGauge ticks_delay,
|
|||
declareGauge next_action_wait,
|
||||
"Seconds until the next attestation will be sent"
|
||||
|
||||
declareGauge next_proposal_wait,
|
||||
"Seconds until the next proposal will be sent, or Inf if not known"
|
||||
|
||||
declareGauge sync_committee_active,
|
||||
"1 if there are current sync committee duties, 0 otherwise"
|
||||
|
||||
declareCounter db_checkpoint_seconds,
|
||||
"Time spent checkpointing the database to clear the WAL file"
|
||||
|
||||
|
@ -1466,19 +1472,21 @@ proc onSlotEnd(node: BeaconNode, slot: Slot) {.async.} =
|
|||
else:
|
||||
toGaugeValue(x)
|
||||
|
||||
let
|
||||
syncCommitteeSlot = slot + 1
|
||||
syncCommitteeEpoch = syncCommitteeSlot.epoch
|
||||
inCurrentSyncCommittee =
|
||||
not node.getCurrentSyncCommiteeSubnets(syncCommitteeEpoch).isZeros()
|
||||
|
||||
template formatSyncCommitteeStatus(): string =
|
||||
let
|
||||
syncCommitteeSlot = slot + 1
|
||||
slotsToNextSyncCommitteePeriod =
|
||||
if inCurrentSyncCommittee:
|
||||
"current"
|
||||
elif not node.getNextSyncCommitteeSubnets(syncCommitteeEpoch).isZeros():
|
||||
let slotsToNextSyncCommitteePeriod =
|
||||
SLOTS_PER_SYNC_COMMITTEE_PERIOD -
|
||||
since_sync_committee_period_start(syncCommitteeSlot)
|
||||
|
||||
# int64 conversion is safe
|
||||
doAssert slotsToNextSyncCommitteePeriod <= SLOTS_PER_SYNC_COMMITTEE_PERIOD
|
||||
|
||||
if not node.getCurrentSyncCommiteeSubnets(syncCommitteeSlot.epoch).isZeros:
|
||||
"current"
|
||||
elif not node.getNextSyncCommitteeSubnets(syncCommitteeSlot.epoch).isZeros:
|
||||
# int64 conversion is safe
|
||||
doAssert slotsToNextSyncCommitteePeriod <= SLOTS_PER_SYNC_COMMITTEE_PERIOD
|
||||
"in " & toTimeLeftString(
|
||||
SECONDS_PER_SLOT.int64.seconds * slotsToNextSyncCommitteePeriod.int64)
|
||||
else:
|
||||
|
@ -1499,6 +1507,14 @@ proc onSlotEnd(node: BeaconNode, slot: Slot) {.async.} =
|
|||
if nextActionSlot != FAR_FUTURE_SLOT:
|
||||
next_action_wait.set(nextActionWaitTime.toFloatSeconds)
|
||||
|
||||
next_proposal_wait.set(
|
||||
if nextProposalSlot != FAR_FUTURE_SLOT:
|
||||
saturate(fromNow(node.beaconClock, nextProposalSlot)).toFloatSeconds()
|
||||
else:
|
||||
Inf)
|
||||
|
||||
sync_committee_active.set(if inCurrentSyncCommittee: 1 else: 0)
|
||||
|
||||
let epoch = slot.epoch
|
||||
if epoch + 1 >= node.network.forkId.next_fork_epoch:
|
||||
# Update 1 epoch early to block non-fork-ready peers
|
||||
|
|
Loading…
Reference in New Issue