Skip to content

Commit 1ec12b4

Browse files
authored
chore: revise epoch transition metric bucket (#8361)
**Motivation** - we want to know more details about the epoch transition time **Description** - revise metric bucket: - 0.01, 0.05, 0.1 is unrealistic even with state-transition-z - add more realistic buckets: 2, 2.5 - sync that with `lodestar_precompute_next_epoch_transition_duration_seconds` - also log epoch transition duration Co-authored-by: Tuyen Nguyen <[email protected]>
1 parent 4a37a4b commit 1ec12b4

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

packages/beacon-node/src/chain/prepareNextSlot.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ export class PrepareNextSlotScheduler {
107107
const precomputeEpochTransitionTimer = isEpochTransition
108108
? this.metrics?.precomputeNextEpochTransition.duration.startTimer()
109109
: null;
110+
const start = Date.now();
110111
// No need to wait for this or the clock drift
111112
// Pre Bellatrix: we only do precompute state transition for the last slot of epoch
112113
// For Bellatrix, we always do the `processSlots()` to prepare payload for the next slot
@@ -228,6 +229,7 @@ export class PrepareNextSlotScheduler {
228229
headSlot,
229230
prepareSlot,
230231
previousHits,
232+
durationMs: Date.now() - start,
231233
});
232234

233235
precomputeEpochTransitionTimer?.();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,7 @@ export function createLodestarMetrics(
14371437
duration: register.histogram({
14381438
name: "lodestar_precompute_next_epoch_transition_duration_seconds",
14391439
help: "Duration of precomputeNextEpochTransition, including epoch transition and hashTreeRoot",
1440-
buckets: [1, 2, 3, 4, 8],
1440+
buckets: [0.2, 0.5, 0.75, 1, 1.25, 1.5, 2, 2.5, 3, 10],
14411441
}),
14421442
},
14431443

packages/state-transition/src/metrics.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ export function getMetrics(register: MetricsRegister) {
1616
epochTransitionTime: register.histogram({
1717
name: "lodestar_stfn_epoch_transition_seconds",
1818
help: "Time to process a single epoch transition in seconds",
19-
// Epoch transitions are 100ms on very fast clients, and average 800ms on heavy networks
20-
buckets: [0.01, 0.05, 0.1, 0.2, 0.5, 0.75, 1, 1.25, 1.5, 3, 10],
19+
// as of Sep 2025, on mainnet, epoch transition time of lodestar is never less than 0.5s, and it could be up to 3s
20+
buckets: [0.2, 0.5, 0.75, 1, 1.25, 1.5, 2, 2.5, 3, 10],
2121
}),
2222
epochTransitionCommitTime: register.histogram({
2323
name: "lodestar_stfn_epoch_transition_commit_seconds",

0 commit comments

Comments
 (0)