[#39] ir: Add optional profilers

Includes `block` and `mutex` profiles configuration.

Signed-off-by: Pavel Karpy <p.karpy@yadro.com>
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Pavel Karpy 2023-04-19 20:02:02 +03:00 committed by Evgenii Stratonikov
parent f989bc52be
commit f604d6bbdc
5 changed files with 72 additions and 8 deletions

View file

@ -64,12 +64,16 @@ func (c *httpComponent) shutdown() error {
return nil
}
func (c *httpComponent) reload() {
log.Info(fmt.Sprintf("reload %s", c.name))
func (c *httpComponent) needReload() bool {
enabled := cfg.GetBool(c.name + enabledKeyPostfix)
address := cfg.GetString(c.name + addressKeyPostfix)
dur := cfg.GetDuration(c.name + shutdownTimeoutKeyPostfix)
if enabled != c.enabled || enabled && (address != c.address || dur != c.shutdownDur) {
return enabled != c.enabled || enabled && (address != c.address || dur != c.shutdownDur)
}
func (c *httpComponent) reload() {
log.Info(fmt.Sprintf("reload %s", c.name))
if c.needReload() {
log.Info(fmt.Sprintf("%s config updated", c.name))
if err := c.shutdown(); err != nil {
log.Debug(logs.FrostFSIRCouldNotShutdownHTTPServer,