I have a http client service:
s := &http.Server{ Addr: config.Port, Handler: Controller.Log(http.DefaultServeMux), ReadTimeout: 3 * time.Second, WriteTimeout: 3 * time.Second, } http.HandleFunc("/exapmle/router/", exampleFunc) err := s.ListenAndServe() if err != nil { log.Critical(err) os.Exit(1) }
Does not work:
go tool pprof http://localhost:8201/debug/pprof/profile
Return Error:
Failed to fetch http://localhost:8201/debug/pprof/profile?seconds=30
Thanks.
edit: I think the problem is that I am rewriting the default HTTP server, the net / http / pprof package introduce the http handler:
func init() { http.Handle("/debug/pprof/", http.HandlerFunc(Index)) http.Handle("/debug/pprof/cmdline", http.HandlerFunc(Cmdline)) http.Handle("/debug/pprof/profile", http.HandlerFunc(Profile)) http.Handle("/debug/pprof/symbol", http.HandlerFunc(Symbol)) }
the handler does not work in my code.
source share