private/lifecycle: monitor unexpected shutdowns

Change-Id: I9af3a95a1b60c1572cd57bb5e9539d60aa0337bb
This commit is contained in:
Egon Elbre 2021-06-25 19:21:30 +03:00
parent 3c8e7e679a
commit 4031336cbd
2 changed files with 4 additions and 0 deletions

View File

@ -1,3 +1,5 @@
storj.io/storj/private/lifecycle."slow_shutdown" Event
storj.io/storj/private/lifecycle."unexpected_shutdown" Event
storj.io/storj/satellite/accounting."bucket_bytes" IntVal
storj.io/storj/satellite/accounting."bucket_inline_bytes" IntVal
storj.io/storj/satellite/accounting."bucket_inline_segments" IntVal

View File

@ -72,6 +72,7 @@ func (group *Group) Run(ctx context.Context, g *errgroup.Group) {
defer shutdownDeadline.Stop()
select {
case <-shutdownDeadline.C:
mon.Event("slow_shutdown") //mon:locked
group.log.Warn("service takes long to shutdown", zap.String("name", item.Name))
group.logStackTrace()
case <-shutdownCtx.Done():
@ -89,6 +90,7 @@ func (group *Group) Run(ctx context.Context, g *errgroup.Group) {
err = errs2.IgnoreCanceled(err)
}
if err != nil {
mon.Event("unexpected_shutdown") //mon:locked
group.log.Error("unexpected shutdown of a runner", zap.String("name", item.Name), zap.Error(err))
}
return err