profiling

package
v6.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package profiling provides opt-in, process-wide Go diagnostics for Stroppy applications.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithConfig

func WithConfig(ctx context.Context, config Config) context.Context

WithConfig supplies profiling options to nested Stroppy runs without changing the environment.

Types

type Config

type Config struct {
	Address              string
	BlockProfileRate     int
	MutexProfileFraction int
}

Config controls process-wide diagnostics. An empty Address disables profiling. Sampling changes benchmark overhead; zero leaves the existing runtime setting untouched.

func Resolve

func Resolve(ctx context.Context, config *Config) (Config, error)

Resolve gives explicit options precedence over context options and process environment.

type Session

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

Session owns one reference to a shared process-wide profiling listener. Concurrent runs with identical options share it until the last session closes.

func Start

func Start(ctx context.Context, config *Config) (*Session, error)

Start enables diagnostics for a caller-owned scope. Nil options use context or environment. Only loopback listeners are accepted because profiles can expose credentials and application data.

func (*Session) Addr

func (s *Session) Addr() string

Addr reports the actual listener address, including an OS-selected port when configured with :0.

func (*Session) Close

func (s *Session) Close() error

Close stops the listener after its last owner exits and cancels active profile requests. Explicit block sampling is disabled; explicit mutex sampling restores its previous fraction.

Jump to

Keyboard shortcuts

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