2020-10-02 16:18:38 +03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2022-12-23 20:35:35 +03:00
|
|
|
profilerconfig "github.com/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/profiler"
|
|
|
|
httputil "github.com/TrueCloudLab/frostfs-node/pkg/util/http"
|
2020-10-02 16:18:38 +03:00
|
|
|
)
|
|
|
|
|
2022-11-24 14:36:49 +03:00
|
|
|
func pprofComponent(c *cfg) (*httpComponent, bool) {
|
|
|
|
var updated bool
|
|
|
|
// check if it has been inited before
|
|
|
|
if c.dynamicConfiguration.pprof == nil {
|
|
|
|
c.dynamicConfiguration.pprof = new(httpComponent)
|
|
|
|
c.dynamicConfiguration.pprof.cfg = c
|
|
|
|
c.dynamicConfiguration.pprof.name = "pprof"
|
|
|
|
c.dynamicConfiguration.pprof.handler = httputil.Handler()
|
|
|
|
updated = true
|
2020-10-02 16:18:38 +03:00
|
|
|
}
|
2021-05-12 01:59:05 +03:00
|
|
|
|
2022-11-24 14:36:49 +03:00
|
|
|
// (re)init read configuration
|
|
|
|
enabled := profilerconfig.Enabled(c.appCfg)
|
|
|
|
if enabled != c.dynamicConfiguration.pprof.enabled {
|
|
|
|
c.dynamicConfiguration.pprof.enabled = enabled
|
|
|
|
updated = true
|
|
|
|
}
|
|
|
|
address := profilerconfig.Address(c.appCfg)
|
|
|
|
if address != c.dynamicConfiguration.pprof.address {
|
|
|
|
c.dynamicConfiguration.pprof.address = address
|
|
|
|
updated = true
|
|
|
|
}
|
|
|
|
dur := profilerconfig.ShutdownTimeout(c.appCfg)
|
|
|
|
if dur != c.dynamicConfiguration.pprof.shutdownDur {
|
|
|
|
c.dynamicConfiguration.pprof.shutdownDur = dur
|
|
|
|
updated = true
|
|
|
|
}
|
2021-08-04 17:44:37 +03:00
|
|
|
|
2022-11-24 14:36:49 +03:00
|
|
|
return c.dynamicConfiguration.pprof, updated
|
2020-10-02 16:18:38 +03:00
|
|
|
}
|