Skip to content

Commit

Permalink
feat: track prepare next epoch time (ChainSafe#6256)
Browse files Browse the repository at this point in the history
* feat: track prepare next epoch time

* Update packages/beacon-node/src/metrics/metrics/lodestar.ts

* Align variable name of timer with histogram naming

---------

Co-authored-by: Cayman <caymannava@gmail.com>
Co-authored-by: Nico Flaig <nflaig@protonmail.com>
  • Loading branch information
3 people authored and ensi321 committed Jan 22, 2024
1 parent 2012c69 commit e3a17f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/beacon-node/src/chain/prepareNextSlot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ export class PrepareNextSlotScheduler {
headRoot,
isEpochTransition,
});
const precomputeEpochTransitionTimer = isEpochTransition
? this.metrics?.precomputeNextEpochTransition.duration.startTimer()
: null;
// No need to wait for this or the clock drift
// Pre Bellatrix: we only do precompute state transition for the last slot of epoch
// For Bellatrix, we always do the `processSlots()` to prepare payload for the next slot
Expand Down Expand Up @@ -133,6 +136,8 @@ export class PrepareNextSlotScheduler {
prepareSlot,
previousHits,
});

precomputeEpochTransitionTimer?.();
}

if (isExecutionStateType(prepareState)) {
Expand Down
5 changes: 5 additions & 0 deletions packages/beacon-node/src/metrics/metrics/lodestar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1298,6 +1298,11 @@ export function createLodestarMetrics(
name: "lodestar_precompute_next_epoch_transition_waste_total",
help: "Total number of precomputing next epoch transition wasted",
}),
duration: register.histogram({
name: "lodestar_precompute_next_epoch_transition_duration_seconds",
help: "Duration of precomputeNextEpochTransition, including epoch transition and hashTreeRoot",
buckets: [1, 2, 3, 4, 8],
}),
},

// reprocess attestations
Expand Down

0 comments on commit e3a17f5

Please sign in to comment.