forked from TrueCloudLab/frostfs-node
[#426] cmd/neofs-node: Fix metric option in local storage
`WithMetrics` can't make nil check without reflection so we have to explicitly check if metrics enabled outside of engine constructor. Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
892b4f4f12
commit
7131e6f339
1 changed files with 6 additions and 4 deletions
|
@ -462,10 +462,12 @@ func (c *cfg) LocalAddress() *network.Address {
|
|||
func initLocalStorage(c *cfg) {
|
||||
initShardOptions(c)
|
||||
|
||||
ls := engine.New(
|
||||
engine.WithLogger(c.log),
|
||||
engine.WithMetrics(c.metricsCollector),
|
||||
)
|
||||
engineOpts := []engine.Option{engine.WithLogger(c.log)}
|
||||
if c.metricsCollector != nil {
|
||||
engineOpts = append(engineOpts, engine.WithMetrics(c.metricsCollector))
|
||||
}
|
||||
|
||||
ls := engine.New(engineOpts...)
|
||||
|
||||
for _, opts := range c.cfgObject.cfgLocalStorage.shardOpts {
|
||||
id, err := ls.AddShard(opts...)
|
||||
|
|
Loading…
Reference in a new issue