node: Start metrics and pprof as soon as possible #882

Merged
fyrchik merged 1 commit from dstepanov-yadro/frostfs-node:fix/metrics_start_order into master 2023-12-21 15:09:55 +00:00
2 changed files with 9 additions and 21 deletions

View file

@ -36,20 +36,18 @@ func (cmp *httpComponent) init(c *cfg) {
cmp.shutdownDur,
),
)
c.closers = append(c.closers, closer{
cmp.name,
func() { stopAndLog(c, cmp.name, srv.Shutdown) },
})
c.workers = append(c.workers, worker{
cmp.name,
func(ctx context.Context) {
runAndLog(ctx, c, cmp.name, false, func(context.Context, *cfg) {
c.wg.Add(1)
go func() {
defer c.wg.Done()
c.log.Info(logs.FrostFSNodeStartListeningEndpoint,
zap.String("service", cmp.name),
zap.String("endpoint", cmp.address))
fatalOnErr(srv.Serve())
Review

Not the case here (everything is on localhost), but what about your recent optimization regarding rebinging to a not-yet-available IP, will it work?

Not the case here (everything is on localhost), but what about your recent optimization regarding rebinging to a not-yet-available IP, will it work?
Review

Now not

Now not
Review

Ok, our current configuration everywhere uses localhost, so #836 is still useful.

Ok, our current configuration everywhere uses localhost, so #836 is still useful.
})
},
}()
c.closers = append(c.closers, closer{
cmp.name,
func() { stopAndLog(c, cmp.name, srv.Shutdown) },
})
}
@ -64,7 +62,6 @@ func (cmp *httpComponent) reload(ctx context.Context) error {
}
// Cleanup
delCloser(cmp.cfg, cmp.name)
delWorker(cmp.cfg, cmp.name)
// Init server with new parameters
cmp.init(cmp.cfg)
// Start worker

View file

@ -30,15 +30,6 @@ func startWorker(ctx context.Context, c *cfg, wrk worker) {
}(wrk)
}
func delWorker(c *cfg, name string) {
for i, worker := range c.workers {
if worker.name == name {
c.workers = append(c.workers[:i], c.workers[i+1:]...)
return
}
}
}
func getWorker(c *cfg, name string) *worker {
for _, wrk := range c.workers {
if wrk.name == name {