Documentation
¶
Overview ¶
Package debug gates Go's runtime profiling endpoints behind an environment switch, so profiling is available while investigating a service and absent in normal operation.
The package is framework-neutral: it exposes an http.Handler and a *http.ServeMux registration helper, both built on net/http/pprof.
Index ¶
Constants ¶
const Prefix = "/debug/pprof/"
Prefix is the route prefix under which the profiling endpoints are served.
Variables ¶
This section is empty.
Functions ¶
func Enabled ¶
func Enabled() bool
Enabled reports whether profiling endpoints should be served. It is true when LOG_LEVEL is "debug", regardless of case.
func Handler ¶
Handler returns a handler serving the pprof endpoints under Prefix. It returns nil when profiling is disabled, which lets callers skip registration entirely rather than mount a handler that refuses every request.
Responses carry X-Debug-Mode: enabled, so a caller can tell a served profile apart from a 404 produced by a service running without profiling.
func IsDebugEnabled
deprecated
func IsDebugEnabled() bool
IsDebugEnabled is a deprecated alias for Enabled.
Deprecated: use Enabled.
Types ¶
This section is empty.