Added sigHandler to print stackTrace, modified probe params
This commit is contained in:
@@ -24,6 +24,9 @@ import (
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
"runtime/debug"
|
||||
|
||||
"github.com/gorilla/handlers"
|
||||
"github.com/gorilla/mux"
|
||||
@@ -171,7 +174,20 @@ func (ss *StorageService) Start(port int) {
|
||||
log.Fatal(http.ListenAndServe(address, handlers.LoggingHandler(os.Stdout, r)))
|
||||
}
|
||||
|
||||
func dumpStackTrace() {
|
||||
debug.PrintStack()
|
||||
}
|
||||
|
||||
func RunStorageService(storageType StorageType, storagePath string, containerName string, port int, enablePruner bool) *StorageService {
|
||||
// register signal handler for dumping stack trace.
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, syscall.SIGTERM)
|
||||
go func() {
|
||||
<-c
|
||||
dumpStackTrace()
|
||||
os.Exit(1)
|
||||
}()
|
||||
|
||||
// initialize logger
|
||||
log.SetLevel(log.InfoLevel)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user