Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EnvProfileOption ¶
type EnvProfileOption func(opts internalOptions)
func NoShutdownHook ¶
func NoShutdownHook() EnvProfileOption
type EnvProfiler ¶
type EnvProfiler interface {
Stop()
}
func EnvProfile ¶
func EnvProfile(envPrefix string, opts ...EnvProfileOption) EnvProfiler
EnvProfile starts a profile based on environment variables.
Expected env vars are prefixed with envPrefix. Env vars used:
- PROFILE: (cpu|block|mem|trace)
- PROFILE_PATH: save profiles to this path, instead of OS temp dir
- PROFILE_RATE: if using cpu, passed to runtime.SetCPUProfileRate(). if using "block", passed to runtime.SetBlockProfileRate()
- PROFILE_QUIET: if not empty, no messages are logged to stderr.
You MUST call Stop() on the returned value when done, even if no profile was started:
defer EnvProfile("MYAPP_").Stop()
--
Click to show internal directories.
Click to hide internal directories.