Skip to content

Commit

Permalink
Rename metrics object
Browse files Browse the repository at this point in the history
  • Loading branch information
nazarhussain committed Oct 23, 2024
1 parent eb16884 commit be6870f
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions packages/beacon-node/src/chain/historicalState/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ const abortController = new AbortController();

// Set up metrics, nodejs, state transition, queue
const metricsRegister = workerData.metricsEnabled ? new RegistryMetricCreator() : null;
const historicalStateRegenMetrics: HistoricalStateRegenMetrics | undefined = metricsRegister
? getMetrics(metricsRegister)
: undefined;
const metrics: HistoricalStateRegenMetrics | undefined = metricsRegister ? getMetrics(metricsRegister) : undefined;
let queueMetrics: QueueMetrics | undefined;
if (metricsRegister) {
const closeMetrics = collectNodeJSMetrics(metricsRegister, "lodestar_historical_state_worker_");
Expand Down Expand Up @@ -85,7 +83,7 @@ const api: HistoricalStateWorkerApi = {
return metricsRegister?.metrics() ?? "";
},
async getHistoricalState(slot, stateArchiveMode) {
historicalStateRegenMetrics?.regenRequestCount.inc();
metrics?.regenRequestCount.inc();

const stateBytes = await queue.push<Uint8Array | null>(() =>
getHistoricalState(slot, {
Expand All @@ -95,14 +93,14 @@ const api: HistoricalStateWorkerApi = {
pubkey2index,
logger,
hierarchicalLayers,
metrics: historicalStateRegenMetrics,
metrics: metrics,
})
);

if (stateBytes) {
const result = Transfer(stateBytes, [stateBytes.buffer]) as unknown as Uint8Array;

historicalStateRegenMetrics?.regenSuccessCount.inc();
metrics?.regenSuccessCount.inc();
return result;
}

Expand All @@ -115,7 +113,7 @@ const api: HistoricalStateWorkerApi = {
logger,
stateArchiveMode,
hierarchicalLayers,
metrics: historicalStateRegenMetrics,
metrics,
});
},
};
Expand Down

0 comments on commit be6870f

Please sign in to comment.