cli: restart pprof and prometheus on HUP

This commit is contained in:
Roman Khimov 2022-07-26 17:19:30 +03:00
parent 6593b94594
commit df24c1268e
2 changed files with 9 additions and 0 deletions

View file

@ -551,6 +551,12 @@ Main:
if !cfgnew.ApplicationConfiguration.RPC.StartWhenSynchronized || serv.IsInSync() {
rpcServer.Start()
}
pprof.ShutDown()
pprof = metrics.NewPprofService(cfgnew.ApplicationConfiguration.Pprof, log)
go pprof.Start()
prometheus.ShutDown()
prometheus = metrics.NewPrometheusService(cfgnew.ApplicationConfiguration.Prometheus, log)
go prometheus.Start()
}
cfg = cfgnew
case <-grace.Done():

View file

@ -31,6 +31,9 @@ func (ms *Service) Start() {
// ShutDown stops the service.
func (ms *Service) ShutDown() {
if !ms.config.Enabled {
return
}
ms.log.Info("shutting down service", zap.String("endpoint", ms.Addr))
err := ms.Shutdown(context.Background())
if err != nil {