debug

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

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

View Source
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

func Handler() http.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.

func Register

func Register(mux *http.ServeMux) bool

Register mounts the profiling endpoints on mux when profiling is enabled, and does nothing otherwise. It reports whether the endpoints were mounted.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL