From be6870ffbc3877bb2f48e016d84d650540ecb353 Mon Sep 17 00:00:00 2001 From: Nazar Hussain Date: Wed, 23 Oct 2024 17:07:16 +0200 Subject: [PATCH] Rename metrics object --- .../beacon-node/src/chain/historicalState/worker.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/beacon-node/src/chain/historicalState/worker.ts b/packages/beacon-node/src/chain/historicalState/worker.ts index 51f58c7fffb..9d6d3169a00 100644 --- a/packages/beacon-node/src/chain/historicalState/worker.ts +++ b/packages/beacon-node/src/chain/historicalState/worker.ts @@ -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_"); @@ -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(() => getHistoricalState(slot, { @@ -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; } @@ -115,7 +113,7 @@ const api: HistoricalStateWorkerApi = { logger, stateArchiveMode, hierarchicalLayers, - metrics: historicalStateRegenMetrics, + metrics, }); }, };