3 回答

TA貢獻(xiàn)1797條經(jīng)驗(yàn) 獲得超6個(gè)贊
user983716 - 感謝您的問(wèn)題和解決方案!
我無(wú)法使用網(wǎng)絡(luò)索引 ( 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"))
}
...
如果有人遇到同樣的問(wèn)題,我希望這會(huì)有所幫助!
- 3 回答
- 0 關(guān)注
- 381 瀏覽
添加回答
舉報(bào)