[#1654] ir, node: Drop deprecated profiler and metrics config sections

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2022-08-03 20:50:01 +03:00 committed by Pavel Karpy
parent 713cfa5610
commit 0a60524a9c
6 changed files with 30 additions and 68 deletions

View file

@ -7,8 +7,7 @@ import (
)
const (
subsection = "prometheus"
subsectionOld = "metrics"
subsection = "prometheus"
// ShutdownTimeoutDefault is a default value for metrics HTTP service timeout.
ShutdownTimeoutDefault = 30 * time.Second
@ -18,25 +17,19 @@ const (
)
// Enabled returns the value of "enabled" config parameter
// from "metrics" section.
// from "prometheus" section.
//
// Returns false if the value is missing or invalid.
func Enabled(c *config.Config) bool {
s := c.Sub(subsection)
s.SetDefault(c.Sub(subsectionOld))
return config.BoolSafe(s, "enabled")
return config.BoolSafe(c.Sub(subsection), "enabled")
}
// ShutdownTimeout returns the value of "shutdown_timeout" config parameter
// from "metrics" section.
// from "prometheus" section.
//
// Returns ShutdownTimeoutDefault if the value is not positive duration.
func ShutdownTimeout(c *config.Config) time.Duration {
s := c.Sub(subsection)
s.SetDefault(c.Sub(subsectionOld))
v := config.DurationSafe(s, "shutdown_timeout")
v := config.DurationSafe(c.Sub(subsection), "shutdown_timeout")
if v > 0 {
return v
}
@ -45,14 +38,11 @@ func ShutdownTimeout(c *config.Config) time.Duration {
}
// Address returns the value of "address" config parameter
// from "metrics" section.
// from "prometheus" section.
//
// Returns AddressDefault if the value is not set.
func Address(c *config.Config) string {
s := c.Sub(subsection)
s.SetDefault(c.Sub(subsectionOld))
v := config.StringSafe(s, "address")
v := config.StringSafe(c.Sub(subsection), "address")
if v != "" {
return v
}