Documentation
¶
Overview ¶
Package pprof downloads CPU and memory profiles from a Pyroscope endpoint after each test phase completes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Downloader ¶
type Downloader struct {
// contains filtered or unexported fields
}
Downloader downloads CPU and memory pprof profiles from a Pyroscope endpoint.
No K8s dependencies — only knows about an HTTP baseURL and a runID. Port-forwarding is the caller's responsibility. Zero value is invalid; always construct via NewDownloader.
func NewDownloader ¶
func NewDownloader(baseURL, runID string, opts ...Option) *Downloader
NewDownloader returns a Downloader targeting baseURL with the given runID. runID is embedded in every output filename for traceability.
func (*Downloader) DownloadForPhase ¶
DownloadForPhase downloads pprof profiles for a completed phase in parallel:
- CPU profile spanning [start, end] (full phase window)
- Memory snapshot at [end-60s, end] (lookback window)
Non-fatal: all errors are logged, never returned. Output files: pprof-<runID>-<phaseName>-cpu.pprof
pprof-<runID>-<phaseName>-memory.pprof
type HTTPClient ¶
HTTPClient is the interface for executing HTTP requests. *http.Client satisfies this interface.
type Option ¶
type Option func(*Downloader)
Option is a functional option for NewDownloader.
func WithAppName ¶
WithAppName overrides the Pyroscope label filter value (default: "grove-system"). Used as the namespace label selector in Pyroscope queries.
func WithDownloadTimeout ¶
WithDownloadTimeout sets the per-download timeout (default: 30s).
func WithHTTPClient ¶
func WithHTTPClient(h HTTPClient) Option
WithHTTPClient replaces the default HTTP client (useful for testing).
func WithLogger ¶
WithLogger sets the logger for the downloader.
func WithOutputDir ¶
WithOutputDir sets the directory for downloaded profile files (default: os.TempDir()).
type ProfileType ¶
type ProfileType string
ProfileType identifies a pprof profile kind exposed by Pyroscope. String value appears in output file names.
const ( ProfileCPU ProfileType = "cpu" ProfileMemory ProfileType = "memory" ProfileGoroutine ProfileType = "goroutine" )
Supported profile types for Pyroscope downloads.
func (ProfileType) QueryPrefix ¶
func (p ProfileType) QueryPrefix() string
QueryPrefix returns the Pyroscope metric selector prefix for this profile type. Single source of truth — switch-based, not a mutable package-level map.