Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateUUID() string
- func NoopSendProfiles([]AgentProfile) error
- type AgentCallSite
- type AgentProfile
- type AllocationSampler
- type BlockSampler
- type CPUSampler
- type CallSite
- type Flag
- type Profile
- type Recorder
- type Sampler
- type SamplerConfig
- type SamplerScheduler
- type SendProfilesFunc
- type Timer
Constants ¶
const ( CategoryCPU = "cpu" CategoryMemory = "memory" CategoryTime = "time" )
Supported profile categories
const ( TypeCPUUsage = "cpu-usage" TypeMemoryAllocation = "memory-allocations" TypeBlockingCalls = "blocking-calls" )
Supported profile types
const ( UnitSample = "sample" UnitMillisecond = "millisecond" UnitMicrosecond = "microsecond" UnitNanosecond = "nanosecond" UnitByte = "byte" UnitKilobyte = "kilobyte" UnitPercent = "percent" )
Human-readable measurement units
const DefaultMaxBufferedProfiles = 100
DefaultMaxBufferedProfiles is the default number of profiles to keep in recorder buffer
const (
RuntimeGolang = "golang"
)
Supported profile runtimes
Variables ¶
var ( // IncludeProfilerFrames is a setting for the frame filter whether or not to include the profiler // frames into the profile IncludeProfilerFrames = false )
Functions ¶
func NoopSendProfiles ¶
func NoopSendProfiles([]AgentProfile) error
NoopSendProfiles is the default function to be called by Recorded to send collected profiles
Types ¶
type AgentCallSite ¶ added in v1.13.2
type AgentCallSite struct { MethodName string `json:"method_name"` FileName string `json:"file_name"` FileLine int64 `json:"file_line"` Measurement float64 `json:"measurement"` NumSamples int64 `json:"num_samples"` Children []AgentCallSite `json:"children"` }
AgentCallSite is a presenter type used to serialize a call site to JSON format supported by Instana profile sensor
func NewAgentCallSite ¶ added in v1.13.2
func NewAgentCallSite(cs *CallSite) AgentCallSite
NewAgentCallSite initializes a new call site payload for the host agent
type AgentProfile ¶ added in v1.13.2
type AgentProfile struct { ID string `json:"id"` Runtime string `json:"runtime"` Category string `json:"category"` Type string `json:"type"` Unit string `json:"unit"` Roots []AgentCallSite `json:"roots"` Duration int64 `json:"duration"` Timespan int64 `json:"timespan"` Timestamp int64 `json:"timestamp"` }
AgentProfile is a presenter type used to serialize a collected profile to JSON format supported by Instana profile sensor
func NewAgentProfile ¶ added in v1.13.2
func NewAgentProfile(p *Profile) AgentProfile
NewAgentProfile creates a new profile payload for the host agent
type AllocationSampler ¶
type AllocationSampler struct{}
AllocationSampler collects information about the number of memory allocations
func NewAllocationSampler ¶
func NewAllocationSampler() *AllocationSampler
NewAllocationSampler initializes a new allocation sampler
func (*AllocationSampler) Profile ¶
func (as *AllocationSampler) Profile(duration int64, timespan int64) (*Profile, error)
Profile retrieves the head profile and converts it to the profile.Profile
func (*AllocationSampler) Reset ¶
func (as *AllocationSampler) Reset()
Reset is a no-op for allocation sampler
func (*AllocationSampler) Start ¶
func (as *AllocationSampler) Start() error
Start is a no-op for allocation sampler
func (*AllocationSampler) Stop ¶
func (as *AllocationSampler) Stop() error
Stop is a no-op for allocation sampler
type BlockSampler ¶
type BlockSampler struct {
// contains filtered or unexported fields
}
BlockSampler collects information about goroutine blocking events, such as waiting on synchronization primitives. This sampler uses the runtime blocking profiler, enabling and disabling it for a period of time.
func NewBlockSampler ¶
func NewBlockSampler() *BlockSampler
NewBlockSampler initializes a new blocking events sampler
func (*BlockSampler) Profile ¶
func (bs *BlockSampler) Profile(duration, timespan int64) (*Profile, error)
Profile return the collected profile for a given time span
func (*BlockSampler) Reset ¶
func (bs *BlockSampler) Reset()
Reset resets the state of a BlockSampler, starting a new call tree
func (*BlockSampler) Start ¶
func (bs *BlockSampler) Start() error
Start enables the reporting of blocking events
func (*BlockSampler) Stop ¶
func (bs *BlockSampler) Stop() error
Stop disables the reporting of blocking events and gathers the collected information into a profile
type CPUSampler ¶
type CPUSampler struct {
// contains filtered or unexported fields
}
CPUSampler collects information about CPU usage
func (*CPUSampler) Profile ¶
func (cs *CPUSampler) Profile(duration int64, timespan int64) (*Profile, error)
Profile returns the recorder profile
func (*CPUSampler) Reset ¶
func (cs *CPUSampler) Reset()
Reset resets the state of a CPUProfiler, starting a new call tree. It does not terminate the profiling, so the gathered profile will make up a new call tree.
func (*CPUSampler) Start ¶
func (cs *CPUSampler) Start() error
Start enables the collection of CPU usage data
func (*CPUSampler) Stop ¶
func (cs *CPUSampler) Stop() error
Stop terminates the collection of CPU usage data and records the collected profile
type CallSite ¶
type CallSite struct { MethodName string FileName string FileLine int64 Metadata map[string]string // contains filtered or unexported fields }
CallSite represents a recorded method call
func NewCallSite ¶
NewCallSite initializes a new CallSite
func (*CallSite) FindOrAddChild ¶
FindOrAddChild adds a new subcall to a call tree. It returns the existing record the subcall already present
func (*CallSite) Increment ¶
Increment increases the sampled measurement while adding up the number of samples used
func (*CallSite) Measurement ¶
Measurement returns the sampled measurement along with the number of samples
type Flag ¶
type Flag struct {
// contains filtered or unexported fields
}
Flag is a boolean value that can be set and unset atomically
func (*Flag) SetIfUnset ¶
SetIfUnset sets the Flag to true if it's false and returns whether the value has been changed
func (*Flag) UnsetIfSet ¶
UnsetIfSet sets the Flag to false if it's true and returns whether the value has been changed
type Profile ¶
type Profile struct { ID string Runtime string Category string Type string Unit string Roots []*CallSite Duration int64 Timespan int64 Timestamp int64 }
Profile holds the gathered profiling data
type Recorder ¶
type Recorder struct { FlushInterval int64 MaxBufferedProfiles int SendProfiles SendProfilesFunc // contains filtered or unexported fields }
Recorder collects and stores recorded profiles
func NewRecorder ¶
func NewRecorder() *Recorder
NewRecorder initializes and returns a new profile recorder
func (*Recorder) Flush ¶
func (pr *Recorder) Flush()
Flush forces the recorder to submit collected profiles
func (*Recorder) Record ¶
func (pr *Recorder) Record(record AgentProfile)
Record stores collected AgentProfile and enqueues it for submission
type Sampler ¶
type Sampler interface { Profile(duration int64, timespan int64) (*Profile, error) Start() error Stop() error Reset() }
Sampler gathers continuous profile samples over a period of time
type SamplerConfig ¶
type SamplerConfig struct { LogPrefix string ReportOnly bool MaxProfileDuration int64 MaxSpanDuration int64 MaxSpanCount int32 SamplingInterval int64 ReportInterval int64 }
SamplerConfig holds profile sampler setting
type SamplerScheduler ¶
type SamplerScheduler struct {
// contains filtered or unexported fields
}
SamplerScheduler periodically runs the sampler for a time period
func NewSamplerScheduler ¶
func NewSamplerScheduler(profileRecorder *Recorder, samp Sampler, config SamplerConfig) *SamplerScheduler
NewSamplerScheduler initializes a new SamplerScheduler for a sampler
func (*SamplerScheduler) Report ¶
func (ss *SamplerScheduler) Report()
Report retrieves the collected profile from the sampler and enqueues it for submission
func (*SamplerScheduler) Reset ¶
func (ss *SamplerScheduler) Reset()
Reset resets the sampler and clears the internal state of the scheduler
func (*SamplerScheduler) Stop ¶
func (ss *SamplerScheduler) Stop()
Stop prevents the SamplerScheduler from running the sampler
type SendProfilesFunc ¶
type SendProfilesFunc func([]AgentProfile) error
SendProfilesFunc is a callback to emit collected profiles from recorder