go icon indicating copy to clipboard operation
go copied to clipboard

net/http/pprof: document all available default profiles

Open nhooyr opened this issue 7 years ago • 4 comments

The docs at the moment only mention a few of the available profiles.

See https://golang.org/pkg/net/http/pprof/

But there are plenty more:

var profileDescriptions = map[string]string{
  	"allocs":       "A sampling of all past memory allocations",
  	"block":        "Stack traces that led to blocking on synchronization primitives",
  	"cmdline":      "The command line invocation of the current program",
  	"goroutine":    "Stack traces of all current goroutines",
  	"heap":         "A sampling of memory allocations of live objects. You can specify the gc GET parameter to run GC before taking the heap sample.",
  	"mutex":        "Stack traces of holders of contended mutexes",
  	"profile":      "CPU profile. You can specify the duration in the seconds GET parameter. After you get the profile file, use the go tool pprof command to investigate the profile.",
  	"threadcreate": "Stack traces that led to the creation of new OS threads",
  	"trace":        "A trace of execution of the current program. You can specify the duration in the seconds GET parameter. After you get the trace file, use the go tool trace command to investigate the trace.",
  }

Should also document the behaviour of the "debug" query parameter controlling the response content type.

nhooyr avatar Sep 18 '18 18:09 nhooyr

The profileDescriptions that you refer to is the output that is returned in /debug/pprof - which is a combined output of all profiles.

But net/http/pprof documentation should show only profiles from that package. The other profiles are from runtime/pprof. And it is documented there - https://golang.org/pkg/runtime/pprof/#Profile.

I don't think we should duplicate documentation across packages.

agnivade avatar Sep 18 '18 18:09 agnivade

I don't think we should duplicate documentation across packages.

At the very least we should link to it.

nhooyr avatar Sep 18 '18 18:09 nhooyr

/cc @ianlancetaylor @bradfitz

agnivade avatar Sep 19 '18 06:09 agnivade

Change https://go.dev/cl/421635 mentions this issue: net/http/pprof: link docs to runtime/pprof

gopherbot avatar Aug 06 '22 13:08 gopherbot