fix: adding memory debugging endpoints
This commit is contained in:
@@ -5,6 +5,8 @@ import (
|
|||||||
"github.com/shuffle/shuffle-shared"
|
"github.com/shuffle/shuffle-shared"
|
||||||
"github.com/shuffle/singul/pkg"
|
"github.com/shuffle/singul/pkg"
|
||||||
|
|
||||||
|
"net/http/pprof"
|
||||||
|
|
||||||
"archive/zip"
|
"archive/zip"
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
@@ -5506,6 +5508,14 @@ func initHandlers() {
|
|||||||
r.HandleFunc("/api/v1/dashboards/{key}/widgets", shuffle.HandleNewWidget).Methods("POST", "OPTIONS")
|
r.HandleFunc("/api/v1/dashboards/{key}/widgets", shuffle.HandleNewWidget).Methods("POST", "OPTIONS")
|
||||||
r.HandleFunc("/api/v1/dashboards/{key}/widgets/{widget_id}", shuffle.HandleGetWidget).Methods("GET", "OPTIONS")
|
r.HandleFunc("/api/v1/dashboards/{key}/widgets/{widget_id}", shuffle.HandleGetWidget).Methods("GET", "OPTIONS")
|
||||||
|
|
||||||
|
if (strings.ToLower(os.Getenv("SHUFFLE_DEBUG_MEMORY")) == "true" || strings.ToLower(os.Getenv("DEBUG_MEMORY")) == "true") {
|
||||||
|
r.HandleFunc("/debug/pprof/", pprof.Index)
|
||||||
|
r.HandleFunc("/debug/pprof/heap", pprof.Handler("heap").ServeHTTP)
|
||||||
|
r.HandleFunc("/debug/pprof/profile", pprof.Profile)
|
||||||
|
r.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
|
||||||
|
r.HandleFunc("/debug/pprof/trace", pprof.Trace)
|
||||||
|
}
|
||||||
|
|
||||||
r.Use(shuffle.RequestMiddleware)
|
r.Use(shuffle.RequestMiddleware)
|
||||||
http.Handle("/", r)
|
http.Handle("/", r)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user