debugserver

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Endpoint is "host:port" for TCP or an absolute path for a unix
	// socket.
	//
	// Empty disables the server. The socket's directory must exist; a stale
	// socket left at the path is replaced.
	Endpoint string `yaml:"endpoint"`
}

Config configures the debug server that serves runtime profiles.

The server has no authentication, and its profiles expose the program's internals and can load the process, so a TCP endpoint should stay on loopback and a unix socket in a directory only root can reach.

type Option

type Option func(*options)

Option configures a Server.

func WithLog

func WithLog(log *zap.Logger) Option

WithLog sets the logger.

type Server

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

Server serves the runtime profiles under /debug/pprof/.

func NewServer

func NewServer(cfg *Config, options ...Option) *Server

NewServer constructs a debug server for cfg.

func (*Server) Run

func (m *Server) Run(ctx context.Context) error

Run serves until ctx is done.

A server without an endpoint returns at once. Requests still in flight when ctx is done are cut off rather than awaited, so a long profile does not hold up shutdown.

Jump to

Keyboard shortcuts

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