forked from TrueCloudLab/frostfs-node
[#1602] config: Rename metrics
and profiler
sections
Depracate old names and remove them in the next release. Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
ac46d1a11f
commit
3a0b06d5da
11 changed files with 66 additions and 28 deletions
|
@ -7,7 +7,8 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
subsection = "metrics"
|
||||
subsection = "prometheus"
|
||||
subsectionOld = "metrics"
|
||||
|
||||
// ShutdownTimeoutDefault is a default value for metrics HTTP service timeout.
|
||||
ShutdownTimeoutDefault = 30 * time.Second
|
||||
|
@ -21,7 +22,10 @@ const (
|
|||
//
|
||||
// Returns false if the value is missing or invalid.
|
||||
func Enabled(c *config.Config) bool {
|
||||
return config.BoolSafe(c.Sub(subsection), "enabled")
|
||||
s := c.Sub(subsection)
|
||||
s.SetDefault(c.Sub(subsectionOld))
|
||||
|
||||
return config.BoolSafe(s, "enabled")
|
||||
}
|
||||
|
||||
// ShutdownTimeout returns the value of "shutdown_timeout" config parameter
|
||||
|
@ -29,7 +33,10 @@ func Enabled(c *config.Config) bool {
|
|||
//
|
||||
// Returns ShutdownTimeoutDefault if the value is not positive duration.
|
||||
func ShutdownTimeout(c *config.Config) time.Duration {
|
||||
v := config.DurationSafe(c.Sub(subsection), "shutdown_timeout")
|
||||
s := c.Sub(subsection)
|
||||
s.SetDefault(c.Sub(subsectionOld))
|
||||
|
||||
v := config.DurationSafe(s, "shutdown_timeout")
|
||||
if v > 0 {
|
||||
return v
|
||||
}
|
||||
|
@ -42,7 +49,10 @@ func ShutdownTimeout(c *config.Config) time.Duration {
|
|||
//
|
||||
// Returns AddressDefault if the value is not set.
|
||||
func Address(c *config.Config) string {
|
||||
v := config.StringSafe(c.Sub(subsection), "address")
|
||||
s := c.Sub(subsection)
|
||||
s.SetDefault(c.Sub(subsectionOld))
|
||||
|
||||
v := config.StringSafe(s, "address")
|
||||
if v != "" {
|
||||
return v
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue