From b8b68b11b3194cae73bab15137db699d76b145a3 Mon Sep 17 00:00:00 2001 From: Martin Redolatti Date: Tue, 1 Aug 2023 11:52:52 -0300 Subject: [PATCH] track shutdown --- splitio/common/runtime.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/splitio/common/runtime.go b/splitio/common/runtime.go index 4eb3116d..1da27d8e 100644 --- a/splitio/common/runtime.go +++ b/splitio/common/runtime.go @@ -2,8 +2,10 @@ package common import ( "errors" + "fmt" "os" "os/signal" + "runtime/debug" "syscall" "time" @@ -79,6 +81,8 @@ func (r *RuntimeImpl) RegisterShutdownHandler() error { signal.Notify(r.osSignals, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT) go func() { s := <-r.osSignals + + r.logger.Info(fmt.Sprintf("received signal %+v", s)) if s == syscall.SIGKILL { os.Exit(0) } @@ -97,6 +101,7 @@ func (r *RuntimeImpl) Uptime() time.Duration { func (r *RuntimeImpl) Shutdown() { r.logger.Info("\n\n * Starting graceful shutdown") r.logger.Info(" * Waiting goroutines stop") + r.logger.Debug("%s", string(debug.Stack())) if r.slackWriter != nil { message, attachments := buildSlackShutdownMessage(r.dashboardTitle, false) r.slackWriter.PostNow(message, attachments) @@ -137,7 +142,7 @@ func buildSlackShutdownMessage(title string, kill bool) ([]byte, []log.SlackMess if title != "" { fields := make([]log.SlackMessageAttachmentFields, 0) fields = append(fields) - attach = []log.SlackMessageAttachment{log.SlackMessageAttachment{ + attach = []log.SlackMessageAttachment{{ Fallback: "Shutting Split-Sync down", Color: color, Fields: []log.SlackMessageAttachmentFields{{