add metric for nextActionWait (#2399)
* add metric for nextActionWait * use toFloatSeconds
This commit is contained in:
parent
c47d636cb3
commit
5ebf36f54d
|
@ -9,7 +9,7 @@
|
|||
|
||||
import
|
||||
chronicles, chronos,
|
||||
../spec/[crypto, datatypes, digest],
|
||||
../spec/[crypto, datatypes],
|
||||
../consensus_object_pools/[blockchain_dag, attestation_pool]
|
||||
|
||||
# TODO: Move to "consensus_object_pools" folder
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
{.push raises: [Defect].}
|
||||
|
||||
import
|
||||
std/[math, tables],
|
||||
std/tables,
|
||||
stew/results,
|
||||
chronicles, chronos, metrics,
|
||||
../spec/[crypto, datatypes, digest],
|
||||
|
|
|
@ -67,6 +67,9 @@ declareGauge finalization_delay,
|
|||
declareGauge ticks_delay,
|
||||
"How long does to take to run the onSecond loop"
|
||||
|
||||
declareGauge next_action_wait,
|
||||
"Seconds until the next attestation will be sent"
|
||||
|
||||
logScope: topics = "beacnde"
|
||||
|
||||
func enrForkIdFromState(state: BeaconState): ENRForkID =
|
||||
|
@ -928,7 +931,8 @@ proc onSlotEnd(node: BeaconNode, slot: Slot) {.async.} =
|
|||
horizonSlot = compute_start_slot_at_epoch(
|
||||
node.attestationSubnets.lastCalculatedAttestationEpoch + 1) - 1
|
||||
nextAttestationSlot = node.getNextAttestation(slot)
|
||||
nextActionWait = saturate(fromNow(node.beaconClock, nextAttestationSlot))
|
||||
nextActionWaitTime =
|
||||
saturate(fromNow(node.beaconClock, nextAttestationSlot))
|
||||
horizonDistance = saturate(fromNow(node.beaconClock, horizonSlot))
|
||||
|
||||
info "Slot end",
|
||||
|
@ -944,9 +948,12 @@ proc onSlotEnd(node: BeaconNode, slot: Slot) {.async.} =
|
|||
if nextAttestationSlot == FAR_FUTURE_SLOT:
|
||||
"n/a"
|
||||
else:
|
||||
shortLog(nextActionWait),
|
||||
shortLog(nextActionWaitTime),
|
||||
lookaheadTime = shortLog(horizonDistance)
|
||||
|
||||
if nextAttestationSlot != FAR_FUTURE_SLOT:
|
||||
next_action_wait.set(nextActionWaitTime.toFloatSeconds)
|
||||
|
||||
node.updateGossipStatus(slot)
|
||||
|
||||
proc onSlotStart(
|
||||
|
|
Loading…
Reference in New Issue