From 8ce9c2fdbe57d10418fd660268f10fe1a82e8749 Mon Sep 17 00:00:00 2001 From: Aditya <60684641+0x0elliot@users.noreply.github.com> Date: Fri, 19 Sep 2025 21:59:26 +0530 Subject: [PATCH] fix: adding memory debugging endpoints --- backend/go-app/main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/backend/go-app/main.go b/backend/go-app/main.go index 79622f95..66577845 100755 --- a/backend/go-app/main.go +++ b/backend/go-app/main.go @@ -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) }