Skip to content

gochore/pprofs

Repository files navigation

pprofs

Auto capture profiles.

Build Status codecov Go Report Card GitHub go.mod Go version GitHub tag (latest by date)

Quick start

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:

export PPROF_DIR="~/somewhere"
export PPROF_TTL="1h"

Or use options:

func main() {
	if err := pprofs.EnableCapture(
		pprofs.WithStorage(pprofs.NewFileStorage("prefix", "~/somewhere", time.Hour)),
	); err != nil {
		panic(err)
	}
	// ...
}

See more examples.

Reference