pprof

package
v1.3.0-rc2 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: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Default loopback ports when profiling.port is unset. Each long-running
	// service must use a distinct port so they can share one service-config.yaml.
	DefaultPortAPI                = 15691
	DefaultPortWorker             = 15692
	DefaultPortPeriodic           = 15693
	DefaultPortAlertExporter      = 15694
	DefaultPortAlertmanagerProxy  = 15695
	DefaultPortRemoteAccess       = 15696
	DefaultPortImageBuilderAPI    = 15697
	DefaultPortImageBuilderWorker = 15698
	DefaultPortTelemetryGateway   = 15699
	DefaultPortPAMIssuer          = 15700
)

Variables

This section is empty.

Functions

func StartInBackground added in v1.3.0

func StartInBackground(ctx context.Context, log logrus.FieldLogger, enabled bool, port int)

StartInBackground starts the pprof server on loopback if enabled is true. It returns immediately; the server stops when ctx is canceled.

Types

type PprofOption

type PprofOption func(*pprofOptions)

PprofOption configures a PprofServer.

func WithCPUCap

func WithCPUCap(d time.Duration) PprofOption

WithCPUCap sets the maximum duration for CPU profiling via /debug/pprof/profile. Only positive durations are applied. Default: 30s

func WithPort

func WithPort(port int) PprofOption

WithPort sets the TCP port for the pprof server. Only positive values are applied. Default: 15689

func WithTraceCap

func WithTraceCap(d time.Duration) PprofOption

WithTraceCap sets the maximum duration for execution tracing via /debug/pprof/trace. Only positive durations are applied. Default: 5s

type PprofServer

type PprofServer struct {
	// contains filtered or unexported fields
}

PprofServer is a localhost-only HTTP server exposing Go runtime profiling endpoints.

func NewPprofServer

func NewPprofServer(log logrus.FieldLogger) *PprofServer

NewPprofServer creates a new pprof server with the given logger. The server binds exclusively to 127.0.0.1 for security.

func (*PprofServer) Run

func (p *PprofServer) Run(ctx context.Context, options ...PprofOption) error

Run starts the pprof HTTP server and blocks until the provided context is canceled or an error occurs. Optional settings can be supplied via PprofOption.

Jump to

Keyboard shortcuts

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