Skip to content

MelonRock/hotrod-golang

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hot R.O.D. - Rides on Demand

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.

Enable pprof endpoints

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.

Releases

No releases published

Packages

No packages published

Languages

  • Go 93.7%
  • HTML 5.6%
  • Other 0.7%