не удается отпрофилировать сервер
Всем привет
Есть такой код
package main
import (
"net/http"
_ "net/http/pprof"
"origin-api/controllers"
"origin-api/getconf"
"github.com/gorilla/mux"
)
func Server(router *mux.Router) *http.Server {
return &http.Server{
Addr: getconf.Server.Addr, //из файла конфига устанавливается :8383
Handler: router,
}
}
func Router() *mux.Router {
router := mux.NewRouter()
router.Handle("/test", controllers.CheckToken(http.HandlerFunc(controllers.Test))).Methods(http.MethodPost)
router.Handle("/deluser", controllers.CheckToken(http.HandlerFunc(controllers.DeleteUser))).Methods(http.MethodPost)
return router
}
func main() {
Server(Router()).ListenAndServe()
}
После запуска этого сервера я делаю
go tool pprof -http=":8383" -seconds=30 http://localhost:8383/debug/pprof/profile
И получаю http://localhost:8383/debug/pprof/profile: server response: 404 Not Found
Обьясните пожалуйста, как запустить отпрофилировать этот сервер? Что делаю не так?
UPD: Если я запускаю отдельный сервер на порут 8181 с импортированным net/http/pprof,
package main
import (
"net/http"
_ "net/http/pprof"
)
func main() {
http.ListenAndServe("localhost:8181", nil)
}
запускаю свой сервре на порту 8383
и делаю
go tool pprof -http=":8383" -seconds=30 http://localhost:8181/debug/pprof/profile
то получаю
listen tcp 127.0.0.1:8383: bind: address already in use