Skip to content

Commit

Permalink
chore: refactor metric name
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths committed Mar 27, 2024
1 parent 121edfe commit f8c669b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ export class PersistentCheckpointStateCache implements CheckpointStateCache {
this.metrics?.statePersistSecFromSlot.observe(this.clock?.secFromSlot(this.clock?.currentSlot ?? 0) ?? 0);
const cpPersist = {epoch: epoch, root: epochBoundaryRoot};
{
const timer = this.metrics?.stateSszDuration.startTimer();
const timer = this.metrics?.stateSerializeDuration.startTimer();
// automatically free the buffer pool after this scope
using stateBytesWithKey = this.serializeState(state);
let stateBytes = stateBytesWithKey?.buffer;
Expand Down
4 changes: 2 additions & 2 deletions packages/beacon-node/src/metrics/metrics/lodestar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1195,8 +1195,8 @@ export function createLodestarMetrics(
help: "Histogram of cloned count per state every time state.clone() is called",
buckets: [1, 2, 5, 10, 50, 250],
}),
stateSszDuration: register.histogram({
name: "lodestar_cp_state_cache_state_ssz_seconds",
stateSerializeDuration: register.histogram({
name: "lodestar_cp_state_cache_state_serialize_seconds",
help: "Histogram of time to serialize state to db",
buckets: [0.1, 0.5, 1, 2, 3, 4],
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,10 @@ describe(
)?.value
).toEqual(reloadCount);

const stateSszMetricValues = await (followupBn.metrics?.cpStateCache.stateSszDuration as Histogram).get();
const stateSszMetricValues = await (followupBn.metrics?.cpStateCache.stateSerializeDuration as Histogram).get();
expect(
stateSszMetricValues?.values.find(
(value) => value.metricName === "lodestar_cp_state_cache_state_ssz_seconds_count"
(value) => value.metricName === "lodestar_cp_state_cache_state_serialize_seconds_count"
)?.value
).toEqual(persistCount);

Expand Down

0 comments on commit f8c669b

Please sign in to comment.