diff --git a/Diagnostics.md b/Diagnostics.md index 6a1921cf..1866b084 100644 --- a/Diagnostics.md +++ b/Diagnostics.md @@ -70,6 +70,16 @@ Additionally to what is provided by the runtime, Go users can create their custo Go will soon allow users to attach [context-scoped labels](https://github.com/golang/proposal/blob/master/design/17280-profile-labels.md) to pprof records. Once profiler labels are available, it will be possible to attach user IDs, request URLs, RPC names, etc. to profiling data which later may be examined by labels. + +**Can I serve the profiler handlers (/debug/proof/…) on a different path and port?** +Yes! net/http/pprof package registers its handlers to the default mux by default. But, you can also register them yourself by using the handlers exported from the package. +For example, the following example will serve the pprof.Profile handler on :7777 at /pprof/profile: + +``` +mux := http.NewServeMux() +mux.HandleFunc("/pprof/profile", pprof.Profile) +http.ListenAndServe(":7777", mux) +``` --- To be continued with tracing, runtime stats, debugging and concurrency sections. \ No newline at end of file