https://github.com/gochore/pprofs
Auto capture profiles.
https://github.com/gochore/pprofs
go golang pprof
Last synced: 5 months ago
JSON representation
Auto capture profiles.
- Host: GitHub
- URL: https://github.com/gochore/pprofs
- Owner: gochore
- License: mit
- Created: 2021-12-30T12:59:18.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-03-07T07:41:24.000Z (over 4 years ago)
- Last Synced: 2024-10-17T13:45:41.260Z (over 1 year ago)
- Topics: go, golang, pprof
- Language: Go
- Homepage:
- Size: 25.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## pprofs
Auto capture profiles.
[](https://travis-ci.com/gochore/pprofs)
[](https://codecov.io/gh/gochore/pprofs)
[](https://goreportcard.com/report/github.com/gochore/pprofs)
[](https://github.com/gochore/pprofs/blob/master/go.mod)
[](https://github.com/gochore/pprofs/releases)
## Quick start
```go
package main
import "github.com/gochore/pprofs"
func main() {
if err := pprofs.EnableCapture(); err != nil {
panic(err)
}
// ...
}
```
It will auto capture profiles and store files in temp dir.
You can specify the dir and the ttl of files by environment variables:
```bash
export PPROF_DIR="~/somewhere"
export PPROF_TTL="1h"
```
Or use options:
```go
func main() {
if err := pprofs.EnableCapture(
pprofs.WithStorage(pprofs.NewFileStorage("prefix", "~/somewhere", time.Hour)),
); err != nil {
panic(err)
}
// ...
}
```
See [more examples](https://github.com/gochore/pprofs/tree/master/_example).
## Reference
- Inspired by [autopprof](https://github.com/rakyll/autopprof).
- Learned a lot from [Continuous Profiling of Go programs](https://medium.com/google-cloud/continuous-profiling-of-go-programs-96d4416af77b).