I'm quite puzzled by a problem that I can't profile my golang program, I have all other endpoints under /debug/pprof but not /debug/pprof/profile for CPU profiling Have anyone ever stumbled across such issue?
go tool pprof http://localhost:7778/debug/pprof/profile
Fetching profile from http://localhost:7778/debug/pprof/profile
Please wait... (30s)
server response: 404 Not Found
while
/debug/pprof/
profiles:
19 block
31 goroutine
10 heap
0 mutex
11 threadcreate
full goroutine stack dump
I setup profiling in this way
r := http.NewServeMux()
r.Handle("/debug/pprof/", http.HandlerFunc(pprof.Index))
What can be the cause?
Updated: running
http.ListenAndServe("localhost:4444", nil)
(i.e. starting default http server) fixes the problem for my custom endpoint