Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stefafafan/pprof-helper
https://github.com/stefafafan/pprof-helper
Last synced: 16 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/stefafafan/pprof-helper
- Owner: stefafafan
- License: mit
- Created: 2023-01-08T07:33:43.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-08T11:07:20.000Z (almost 2 years ago)
- Last Synced: 2024-06-20T20:59:48.199Z (7 months ago)
- Language: Go
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pprof-helper
A helper for using Go's [pprof package](https://pkg.go.dev/net/http/pprof) with web applications. For now, it just prints out pseudocode.## Installation
```sh
go install github.com/stefafafan/pprof-helper
```## Usage
Go to the directory with `go.mod` and call the helper. The helper will go through your `go.mod` and for now just print out pseudocode that matches the used web framework.```sh
$ cd your-go-project
$ pprof-helper
For goji, update the code like this:
import (
"net/http/pprof"
)func main() {
mux := goji.NewMux()mux.HandleFunc(pat.Get("/debug/pprof/"), pprof.Index)
mux.HandleFunc(pat.Get("/debug/pprof/cmdline"), pprof.Cmdline)
mux.HandleFunc(pat.Get("/debug/pprof/profile"), pprof.Profile)
mux.HandleFunc(pat.Get("/debug/pprof/symbol"), pprof.Symbol)
}
```You can also specify `--go-mod-file` option, which is the path of the `go.mod` instead of moving to that directory.
```sh
$ pprof-helper --go-mod-file=./my-go-project/go.mod
```