Documentation ¶
Index ¶
Constants ¶
const ( // DefaultPeriod specifies the default period at which profiles will be collected. DefaultPeriod = 30 * time.Second // DefaultDuration specifies the default length of the CPU profile snapshot. DefaultDuration = time.Second * 15 // DefaultUploadTimeout specifies the default timeout for uploading profiles. DefaultUploadTimeout = 10 * time.Second )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { // targetURL is the upload destination URL. It will be set by the profiler on start to either apiURL or agentURL // based on the other options. Service string Types map[ProfileType]struct{} Period time.Duration CpuDuration time.Duration UploadTimeout time.Duration MaxGoroutinesWait int OutputDir string // contains filtered or unexported fields }
func (*Config) AddProfileType ¶
func (c *Config) AddProfileType(t ProfileType)
type Option ¶
type Option func(*Config)
An Option is used to configure the profiler's behaviour.
func CPUDuration ¶
CPUDuration specifies the length at which to collect CPU profiles.
func WithPeriod ¶
WithPeriod specifies the interval at which to collect profiles.
func WithProfileTypes ¶
func WithProfileTypes(types ...ProfileType) Option
WithProfileTypes specifies the profile types to be collected by the profiler.
func WithService ¶
WithService specifies the service name to attach to a profile.
func WithUploadTimeout ¶
WithUploadTimeout specifies the timeout to use for uploading profiles. The default timeout is specified by DefaultUploadTimeout or the DD_PROFILING_UPLOAD_TIMEOUT env variable. Using a negative value or 0 will cause an error when starting the profiler.
func WithUploader ¶
func WithUploader(uploader uploader.IProfileUploader) Option
type ProfileType ¶
type ProfileType int
ProfileType represents a type of profile that the profiler is able to run.
const ( // HeapProfile reports memory allocation samples; used to monitor current // and historical memory usage, and to check for memory leaks. HeapProfile ProfileType = iota // CPUProfile determines where a program spends its time while actively consuming // CPU cycles (as opposed to while sleeping or waiting for I/O). CPUProfile // GoroutineProfile reports stack traces of all current goroutines GoroutineProfile // MetricsProfile reports top-line metrics associated with user-specified profiles MetricsProfile )
func (ProfileType) Filename ¶
func (t ProfileType) Filename() string
Filename is the identifier used on upload.
func (ProfileType) String ¶
func (t ProfileType) String() string
String returns the name of the profile.