Skip to content

Commit

Permalink
feat: track prepare next epoch time
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths committed Jan 8, 2024
1 parent b3e5621 commit fc4ba7b
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 lodestarPrecomputeEpochTransitionTimer = 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,
});

lodestarPrecomputeEpochTransitionTimer?.();
}

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 at lodestar side",
buckets: [1, 2, 3, 4, 8],
}),
},

// reprocess attestations
Expand Down

0 comments on commit fc4ba7b

Please sign in to comment.