The project is a fork of https://github.com/jaegertracing/jaeger/tree/master/examples/hotrod. All the credits go to the authors.
We use the application in examples of how Pyroscope server pulls profiling data from remote targets.
The only change we made is enabling pprof
endpoints – see main.go:
func main() {
mux := http.NewServeMux()
mux.HandleFunc("/debug/pprof/", pprof.Index)
mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
mux.HandleFunc("/debug/pprof/trace", pprof.Trace)
go func() {
log.Println(http.ListenAndServe(":6060", mux))
}()
cmd.Execute()
}
Note that pprof
package can also register endpoints globally:
package main
import (
"fmt"
"net/http"
_ "net/http/pprof"
)
func main() {
// Server for pprof.
go func() {
fmt.Println(http.ListenAndServe(":6060", nil))
}()
// Your code.
}
Please, refer to pprof
package documentation and
diagnostics guide to learn more.