[#493] cmd/node: Use new config for profiler configuration
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
561c809fa5
commit
da8310f0e3
2 changed files with 6 additions and 8 deletions
|
@ -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)
|
||||
|
|
|
@ -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),
|
||||
),
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue