Fix epoch metric #773

Merged
fyrchik merged 1 commit from dstepanov-yadro/frostfs-node:fix/epoch_metric into master 2023-11-01 10:57:32 +00:00
Showing only changes of commit 616aafc494 - Show all commits

View file

@ -562,10 +562,11 @@ func initCfg(appCfg *config.Config) *cfg {
relayOnly := nodeconfig.Relay(appCfg)
fyrchik marked this conversation as resolved Outdated

So we partially initialize netState because we need it in initShared and then finalize netState initialization.
The same problem with metrics can happen inside initShared
To me the problem is that initialization order in code does not match real order.
What about initializing metrics first somewhere? Or is it too much work?

So we partially initialize `netState` because we need it in `initShared` and then finalize `netState` initialization. The same problem with metrics can happen inside `initShared` To me the problem is that initialization order in code does not match real order. What about initializing metrics first somewhere? Or is it too much work?

shared holds metrics, so looks like metrics are initialized correctly. Also cfgNetmap holds netstate, so it also looks ok for me. So i don't think it should be refactored.

`shared` holds metrics, so looks like metrics are initialized correctly. Also `cfgNetmap` holds `netstate`, so it also looks ok for me. So i don't think it should be refactored.
netState := newNetworkState()
netState.metrics = c.metricsCollector
c.shared = initShared(appCfg, key, netState, relayOnly)
netState.metrics = c.metricsCollector
logPrm, err := c.loggerPrm()
fatalOnErr(err)
logPrm.SamplingHook = c.metricsCollector.LogMetrics().GetSamplingHook()