3 回答

TA貢獻1797條經驗 獲得超6個贊
user983716 - 感謝您的問題和解決方案!
我無法使用網絡索引 ( http://[my-server]/debug/pprof ) 中的鏈接,直到我在您的解決方案中添加了幾行,如下所示:
...
func AttachProfiler(router *mux.Router) {
router.HandleFunc("/debug/pprof/", pprof.Index)
router.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
router.HandleFunc("/debug/pprof/profile", pprof.Profile)
router.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
// Manually add support for paths linked to by index page at /debug/pprof/
router.Handle("/debug/pprof/goroutine", pprof.Handler("goroutine"))
router.Handle("/debug/pprof/heap", pprof.Handler("heap"))
router.Handle("/debug/pprof/threadcreate", pprof.Handler("threadcreate"))
router.Handle("/debug/pprof/block", pprof.Handler("block"))
}
...
如果有人遇到同樣的問題,我希望這會有所幫助!
- 3 回答
- 0 關注
- 394 瀏覽
添加回答
舉報