|
@@ -5,7 +5,9 @@ import (
|
|
"net/http"
|
|
"net/http"
|
|
"strings"
|
|
"strings"
|
|
|
|
|
|
|
|
+ stackdump "github.com/docker/docker/pkg/signal"
|
|
"github.com/docker/libnetwork/diagnose"
|
|
"github.com/docker/libnetwork/diagnose"
|
|
|
|
+ "github.com/sirupsen/logrus"
|
|
)
|
|
)
|
|
|
|
|
|
const (
|
|
const (
|
|
@@ -24,6 +26,7 @@ var NetDbPaths2Func = map[string]diagnose.HTTPHandlerFunc{
|
|
"/deleteentry": dbDeleteEntry,
|
|
"/deleteentry": dbDeleteEntry,
|
|
"/getentry": dbGetEntry,
|
|
"/getentry": dbGetEntry,
|
|
"/gettable": dbGetTable,
|
|
"/gettable": dbGetTable,
|
|
|
|
+ "/dump": dbStackTrace,
|
|
}
|
|
}
|
|
|
|
|
|
func dbJoin(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
|
func dbJoin(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
|
@@ -240,3 +243,12 @@ func dbGetTable(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+func dbStackTrace(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
|
|
|
+ path, err := stackdump.DumpStacks("/tmp/")
|
|
|
|
+ if err != nil {
|
|
|
|
+ logrus.WithError(err).Error("failed to write goroutines dump")
|
|
|
|
+ } else {
|
|
|
|
+ fmt.Fprintf(w, "goroutine stacks written to %s", path)
|
|
|
|
+ }
|
|
|
|
+}
|