[#1602] config: Enable metrics and profiler services with a flag

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-07-13 12:17:37 +03:00 committed by fyrchik
parent 12dc5c3395
commit ac46d1a11f
16 changed files with 53 additions and 15 deletions

View file

@ -321,9 +321,11 @@ func initCfg(path string) *cfg {
user.IDFromKey(&c.ownerIDFromKey, key.PrivateKey.PublicKey)
if metricsconfig.Address(c.appCfg) != "" {
if metricsconfig.Enabled(c.appCfg) {
c.metricsCollector = metrics.NewStorageMetrics()
netState.metrics = c.metricsCollector
} else {
c.log.Info("prometheus metrics are disabled")
}
c.onShutdown(c.clientCache.CloseAll) // clean up connections