rename new timing metrics, as `_total` suffix is implicit (#5917)

* track latest duration instead of total in new timing metrics

Change `db_checkpoint_seconds` and `state_replay_seconds` metrics to
record the latest duration instead of the total. `nim-metrics` already
synthesizes a `_total` metric from these implicitly.

* still have to use inc, metrics only synthesizes the name not the sum

* prefix with `beacon_dag`
This commit is contained in:
Etan Kissling 2024-02-20 20:34:41 +01:00 committed by GitHub
parent 9286eb6795
commit 88045a91cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View File

@ -49,7 +49,7 @@ declareGauge beacon_current_active_validators, "Number of validators in the acti
declareGauge beacon_pending_deposits, "Number of pending deposits (state.eth1_data.deposit_count - state.eth1_deposit_index)" # On block declareGauge beacon_pending_deposits, "Number of pending deposits (state.eth1_data.deposit_count - state.eth1_deposit_index)" # On block
declareGauge beacon_processed_deposits_total, "Number of total deposits included on chain" # On block declareGauge beacon_processed_deposits_total, "Number of total deposits included on chain" # On block
declareCounter total_state_replay_seconds, "Total time spent replaying states" declareCounter beacon_dag_state_replay_seconds, "Time spent replaying states"
const const
EPOCHS_PER_STATE_SNAPSHOT* = 32 EPOCHS_PER_STATE_SNAPSHOT* = 32
@ -1845,7 +1845,7 @@ proc updateState*(
let let
assignDur = assignTick - startTick assignDur = assignTick - startTick
replayDur = Moment.now() - assignTick replayDur = Moment.now() - assignTick
total_state_replay_seconds.inc(replayDur.toFloatSeconds) beacon_dag_state_replay_seconds.inc(replayDur.toFloatSeconds)
# TODO https://github.com/status-im/nim-chronicles/issues/108 # TODO https://github.com/status-im/nim-chronicles/issues/108
if (assignDur + replayDur) >= MinSignificantProcessingDuration: if (assignDur + replayDur) >= MinSignificantProcessingDuration:

View File

@ -51,8 +51,8 @@ declareGauge ticks_delay,
declareGauge next_action_wait, declareGauge next_action_wait,
"Seconds until the next attestation will be sent" "Seconds until the next attestation will be sent"
declareCounter total_db_checkpoint_seconds, declareCounter db_checkpoint_seconds,
"Total time spent checkpointing the database to clear the WAL file" "Time spent checkpointing the database to clear the WAL file"
proc doRunTrustedNodeSync( proc doRunTrustedNodeSync(
db: BeaconChainDB, db: BeaconChainDB,
@ -1392,7 +1392,7 @@ proc onSlotEnd(node: BeaconNode, slot: Slot) {.async.} =
let let
dbCheckpointTick = Moment.now() dbCheckpointTick = Moment.now()
dbCheckpointDur = dbCheckpointTick - gcCollectionTick dbCheckpointDur = dbCheckpointTick - gcCollectionTick
total_db_checkpoint_seconds.inc(dbCheckpointDur.toFloatSeconds) db_checkpoint_seconds.inc(dbCheckpointDur.toFloatSeconds)
if dbCheckpointDur >= MinSignificantProcessingDuration: if dbCheckpointDur >= MinSignificantProcessingDuration:
info "Database checkpointed", dur = dbCheckpointDur info "Database checkpointed", dur = dbCheckpointDur
else: else: