Package webstack provides a http.HandlerFunc that serves a snapshot similar to net/http/pprof.Index().
Contrary to net/http/pprof, the handler is not automatically registered.
func SnapshotHandler ¶
SnapshotHandler implements http.HandlerFunc to returns a panicparse HTML format for a snapshot of the current goroutines.
For best results, compile the executable with inlining disabled with -gcflags '-l'.
Arguments are passed as form values. If you want to change the default, override the form values in a wrapper as shown in the example.
The implementation is designed to be reasonably fast, it currently does a small amount of disk I/O only for file presence.
It is a direct replacement for "/debug/pprof/goroutine?debug=2" handler in net/http/pprof.
augment: (default: 1) When set to 1, panicparse tries to find the sources on disk to improve the display of arguments based on type information. This is slower and should be avoided on high utilization server.
maxmem: (default: 67108864) maximum amount of temporary memory to use to generate a snapshot. In practice at least the double of this is used. Minimum is 1048576.
similarity: (default: "anypointer") Can be one of stack.Similarity value in lowercase: "exactflags", "exactlines", "anypointer" or "anyvalue".
Example (Complex) ¶