Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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.