diff --git a/beacon_chain/nimbus_beacon_node.nim b/beacon_chain/nimbus_beacon_node.nim index 295f4cdc9..d5c274c6a 100644 --- a/beacon_chain/nimbus_beacon_node.nim +++ b/beacon_chain/nimbus_beacon_node.nim @@ -2377,13 +2377,6 @@ proc doRunBeaconNode(config: var BeaconNodeConf, rng: ref HmacDrbgContext) {.rai config.createDumpDirs() - let metricsServer = (waitFor config.initMetricsServer()).valueOr: - return - - # Nim GC metrics (for the main thread) will be collected in onSecond(), but - # we disable piggy-backing on other metrics here. - setSystemMetricsAutomaticUpdate(false) - # There are no managed event loops in here, to do a graceful shutdown, but # letting the default Ctrl+C handler exit is safe, since we only read from # the db. @@ -2426,6 +2419,13 @@ proc doRunBeaconNode(config: var BeaconNodeConf, rng: ref HmacDrbgContext) {.rai let node = waitFor BeaconNode.init(rng, config, metadata) + let metricsServer = (waitFor config.initMetricsServer()).valueOr: + return + + # Nim GC metrics (for the main thread) will be collected in onSecond(), but + # we disable piggy-backing on other metrics here. + setSystemMetricsAutomaticUpdate(false) + node.metricsServer = metricsServer if bnStatus == BeaconNodeStatus.Stopping: