Documentation
¶
Overview ¶
Package pyroscope implements profiling.Provider by pushing profiles continuously to a Pyroscope server.
It is the provider for profiles you did not know you would need: CPU, alloc, in-use memory, and goroutine profiles are uploaded on a timer under the service name, so the profile covering an incident exists whether or not anyone was collecting during it. The pprof sibling is the opposite trade — nothing leaves the process, but somebody has to fetch a profile while the behavior is still happening.
Profiling begins when the provider is constructed, not when Start is called; Start is a no-op kept for the interface. That means construction is already the side effect, and a provider built and discarded is still uploading until Shutdown.
Enabling the mutex or block profiles sets the runtime's sampling rate for the whole process and adds the corresponding profile types to the upload set. Both cost something on every contended lock, which is why they are off by default.
The Insecure flag disables TLS certificate verification on uploads — the pyroscope client exposes no such knob, so uploads are routed through an HTTP client that skips it. It exists for a self-signed internal endpoint and nothing else: it disables verification altogether rather than trusting a particular certificate.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Tags map[string]string `env:"-" json:"tags,omitempty" yaml:"tags,omitempty"`
ServerAddress string `env:"SERVER_ADDRESS" json:"serverAddress,omitempty" yaml:"serverAddress,omitempty"`
BasicAuthUser string `env:"BASIC_AUTH_USER" json:"basicAuthUser,omitempty" yaml:"basicAuthUser,omitempty"`
BasicAuthPassword string `env:"BASIC_AUTH_PASSWORD" json:"basicAuthPassword,omitempty" yaml:"basicAuthPassword,omitempty"`
UploadRate time.Duration `env:"UPLOAD_RATE" json:"uploadRate,omitempty" yaml:"uploadRate,omitempty"`
Insecure bool `env:"INSECURE" json:"insecure,omitempty" yaml:"insecure,omitempty"`
EnableMutexProfile bool `env:"ENABLE_MUTEX_PROFILE" json:"enableMutexProfile,omitempty" yaml:"enableMutexProfile,omitempty"`
EnableBlockProfile bool `env:"ENABLE_BLOCK_PROFILE" json:"enableBlockProfile,omitempty" yaml:"enableBlockProfile,omitempty"`
}
Config holds Pyroscope-specific profiling configuration.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider is the Pyroscope profiling.Provider implementation. It is exported, and returned by NewProfilingProvider, so a caller who has chosen Pyroscope can depend on that choice rather than on the interface every profiler shares.
func NewProfilingProvider ¶
func NewProfilingProvider(ctx context.Context, logger logging.Logger, serviceName string, cfg *Config) (*Provider, error)
NewProfilingProvider creates a Pyroscope-based profiling provider.
A nil Config is an error rather than a noop. Asking this package for a provider is asking for Pyroscope, and handing back something that profiles nothing would hide the misconfiguration for the life of the process.