A simple metric for measuring the delay in the onSecond timer
This commit is contained in:
parent
30a8ec410d
commit
224ebdfd72
7
Makefile
7
Makefile
|
@ -211,6 +211,13 @@ medalla-vc: | beacon_node validator_client
|
||||||
--rpc-port=$$(( $(BASE_RPC_PORT) +$(NODE_ID) ))
|
--rpc-port=$$(( $(BASE_RPC_PORT) +$(NODE_ID) ))
|
||||||
|
|
||||||
medalla-dev: | beacon_node
|
medalla-dev: | beacon_node
|
||||||
|
mkdir -p build/data/shared_medalla_$(NODE_ID)
|
||||||
|
|
||||||
|
scripts/make_prometheus_config.sh \
|
||||||
|
--nodes 1 \
|
||||||
|
--base-metrics-port $$(($(BASE_METRICS_PORT) + $(NODE_ID))) \
|
||||||
|
--config-file "build/data/shared_medalla_$(NODE_ID)/prometheus.yml"
|
||||||
|
|
||||||
build/beacon_node \
|
build/beacon_node \
|
||||||
--network=medalla \
|
--network=medalla \
|
||||||
--log-level="DEBUG; TRACE:discv5,networking; REQUIRED:none; DISABLED:none" \
|
--log-level="DEBUG; TRACE:discv5,networking; REQUIRED:none; DISABLED:none" \
|
||||||
|
|
|
@ -65,6 +65,9 @@ declareCounter beacon_blocks_received,
|
||||||
declareGauge finalization_delay,
|
declareGauge finalization_delay,
|
||||||
"Epoch delay between scheduled epoch and finalized epoch"
|
"Epoch delay between scheduled epoch and finalized epoch"
|
||||||
|
|
||||||
|
declareGauge ticks_delay,
|
||||||
|
"How long does to take to run the onSecond loop"
|
||||||
|
|
||||||
const delayBuckets = [2.0, 4.0, 6.0, 8.0, 10.0, 12.0, 14.0, Inf]
|
const delayBuckets = [2.0, 4.0, 6.0, 8.0, 10.0, 12.0, 14.0, Inf]
|
||||||
|
|
||||||
declareHistogram beacon_attestation_received_seconds_from_slot_start,
|
declareHistogram beacon_attestation_received_seconds_from_slot_start,
|
||||||
|
@ -538,23 +541,24 @@ proc handleMissingBlocks(node: BeaconNode) =
|
||||||
info "Requesting detected missing blocks", blocks = shortLog(missingBlocks)
|
info "Requesting detected missing blocks", blocks = shortLog(missingBlocks)
|
||||||
node.requestManager.fetchAncestorBlocks(missingBlocks)
|
node.requestManager.fetchAncestorBlocks(missingBlocks)
|
||||||
|
|
||||||
proc onSecond(node: BeaconNode) {.async.} =
|
proc onSecond(node: BeaconNode) =
|
||||||
## This procedure will be called once per second.
|
## This procedure will be called once per second.
|
||||||
if not(node.syncManager.inProgress):
|
if not(node.syncManager.inProgress):
|
||||||
node.handleMissingBlocks()
|
node.handleMissingBlocks()
|
||||||
|
|
||||||
proc runOnSecondLoop(node: BeaconNode) {.async.} =
|
proc runOnSecondLoop(node: BeaconNode) {.async.} =
|
||||||
var sleepTime = chronos.seconds(1)
|
let sleepTime = chronos.seconds(1)
|
||||||
|
const nanosecondsIn1s = float(chronos.seconds(1).nanoseconds)
|
||||||
while true:
|
while true:
|
||||||
await chronos.sleepAsync(sleepTime)
|
|
||||||
let start = chronos.now(chronos.Moment)
|
let start = chronos.now(chronos.Moment)
|
||||||
await node.onSecond()
|
await chronos.sleepAsync(sleepTime)
|
||||||
let finish = chronos.now(chronos.Moment)
|
let afterSleep = chronos.now(chronos.Moment)
|
||||||
debug "onSecond task completed", elapsed = $(finish - start)
|
let sleepTime = afterSleep - start
|
||||||
if finish - start > chronos.seconds(1):
|
node.onSecond()
|
||||||
sleepTime = chronos.seconds(0)
|
let finished = chronos.now(chronos.Moment)
|
||||||
else:
|
let processingTime = finished - afterSleep
|
||||||
sleepTime = chronos.seconds(1) - (finish - start)
|
ticks_delay.set(sleepTime.nanoseconds.float / nanosecondsIn1s)
|
||||||
|
debug "onSecond task completed", sleepTime, processingTime
|
||||||
|
|
||||||
proc runForwardSyncLoop(node: BeaconNode) {.async.} =
|
proc runForwardSyncLoop(node: BeaconNode) {.async.} =
|
||||||
func getLocalHeadSlot(): Slot =
|
func getLocalHeadSlot(): Slot =
|
||||||
|
|
Loading…
Reference in New Issue