diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index 821b7dbe..291f73d2 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -51,10 +51,6 @@ import ( ) const ( - // pprof keys - cfgProfilerAddr = "profiler.address" - cfgProfilerShutdownTimeout = "profiler.shutdown_timeout" - // metrics keys cfgMetricsAddr = "metrics.address" cfgMetricsShutdownTimeout = "metrics.shutdown_timeout" @@ -149,6 +145,8 @@ const notificationHandlerPoolSize = 10 type cfg struct { ctx context.Context + appCfg *config.Config + ctxCancel func() internalErr chan error // channel for internal application errors at runtime @@ -378,6 +376,7 @@ func initCfg(path string) *cfg { c := &cfg{ ctx: context.Background(), + appCfg: appCfg, internalErr: make(chan error), viper: viperCfg, log: log, @@ -473,8 +472,6 @@ func defaultConfiguration(v *viper.Viper) { v.SetDefault(cfgNetmapContract, "") - v.SetDefault(cfgProfilerShutdownTimeout, "30s") - v.SetDefault(cfgMetricsShutdownTimeout, "30s") v.SetDefault(cfgPolicerHeadTimeout, 5*time.Second) diff --git a/cmd/neofs-node/pprof.go b/cmd/neofs-node/pprof.go index 9135484b..dc6f74b1 100644 --- a/cmd/neofs-node/pprof.go +++ b/cmd/neofs-node/pprof.go @@ -3,12 +3,13 @@ package main import ( "context" + profilerconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/profiler" httputil "github.com/nspcc-dev/neofs-node/pkg/util/http" "go.uber.org/zap" ) func initProfiler(c *cfg) { - addr := c.viper.GetString(cfgProfilerAddr) + addr := profilerconfig.Address(c.appCfg) if addr == "" { return } @@ -20,7 +21,7 @@ func initProfiler(c *cfg) { srv := httputil.New(prm, httputil.WithShutdownTimeout( - c.viper.GetDuration(cfgProfilerShutdownTimeout), + profilerconfig.ShutdownTimeout(c.appCfg), ), )