diff --git a/main.go b/main.go index aaf3fb7..ceb9aeb 100644 --- a/main.go +++ b/main.go @@ -4,7 +4,9 @@ import ( "fmt" "log/slog" "net/http" + "net/http/pprof" "os" + "runtime" "esdi/cmd" "esdi/config" @@ -59,11 +61,19 @@ func setupLogger() error { func runStatviz() error { mux := http.NewServeMux() - err := statsviz.Register(mux) + err := statsviz.Register(mux, statsviz.Root("/")) if err != nil { return err } + runtime.SetBlockProfileRate(1) + runtime.SetMutexProfileFraction(1) + mux.HandleFunc("/debug/pprof/", pprof.Index) + mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline) + mux.HandleFunc("/debug/pprof/profile", pprof.Profile) + mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol) + mux.HandleFunc("/debug/pprof/trace", pprof.Trace) + go func() { err := http.ListenAndServe("localhost:8001", mux) if err != nil {