fix: adding memory debugging endpoints

This commit is contained in:
Aditya
2025-09-19 21:59:26 +05:30
parent 7612b4b7bb
commit 8ce9c2fdbe
+10
View File
@@ -5,6 +5,8 @@ import (
"github.com/shuffle/shuffle-shared"
"github.com/shuffle/singul/pkg"
"net/http/pprof"
"archive/zip"
"bufio"
"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/{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)
http.Handle("/", r)
}