Documentation ¶
Overview ¶
Package tracer contains functionality for populating tracers.
Index ¶
- Constants
- func GetCurrentKernelVersion() (major, minor, patch uint32, err error)
- func ProbeBPFSyscall() error
- type Config
- type Intervals
- type Tracer
- func (t *Tracer) AttachSchedMonitor() error
- func (t *Tracer) AttachTracer() error
- func (t *Tracer) Close()
- func (t *Tracer) EnableProfiling() error
- func (t *Tracer) StartMapMonitors(ctx context.Context, traceOutChan chan *host.Trace) error
- func (t *Tracer) StartPIDEventProcessor(ctx context.Context)
- func (t *Tracer) StartProbabilisticProfiling(ctx context.Context)
- func (t *Tracer) TraceProcessor() tracehandler.TraceProcessor
Constants ¶
const ( // ProbabilisticThresholdMax defines the upper bound of the probabilistic profiling // threshold. ProbabilisticThresholdMax = 100 )
Variables ¶
This section is empty.
Functions ¶
func GetCurrentKernelVersion ¶
GetCurrentKernelVersion returns the major, minor and patch version of the kernel of the host from the utsname struct.
func ProbeBPFSyscall ¶
func ProbeBPFSyscall() error
ProbeBPFSyscall checks if the syscall EBPF is available on the system.
Types ¶
type Config ¶
type Config struct { // Reporter allows swapping out the reporter implementation. Reporter reporter.SymbolReporter // Intervals provides access to globally configured timers and counters. Intervals Intervals // IncludeTracers holds information about which tracers are enabled. IncludeTracers types.IncludedTracers // SamplesPerSecond holds the number of samples per second. SamplesPerSecond int // MapScaleFactor is the scaling factor for eBPF map sizes. MapScaleFactor int // FilterErrorFrames indicates whether error frames should be filtered. FilterErrorFrames bool // KernelVersionCheck indicates whether the kernel version should be checked. KernelVersionCheck bool // DebugTracer indicates whether to load the debug version of eBPF tracers. DebugTracer bool // BPFVerifierLogLevel is the log level of the eBPF verifier output. BPFVerifierLogLevel uint32 // ProbabilisticInterval is the time interval for which probabilistic profiling will be enabled. ProbabilisticInterval time.Duration // ProbabilisticThreshold is the threshold for probabilistic profiling. ProbabilisticThreshold uint }
type Intervals ¶
type Intervals interface { MonitorInterval() time.Duration TracePollInterval() time.Duration PIDCleanupInterval() time.Duration }
Intervals is a subset of config.IntervalsAndTimers.
type Tracer ¶
type Tracer struct {
// contains filtered or unexported fields
}
Tracer provides an interface for loading and initializing the eBPF components as well as for monitoring the output maps for new traces and count updates.
func NewTracer ¶
NewTracer loads eBPF code and map definitions from the ELF module at the configured path.
func (*Tracer) AttachSchedMonitor ¶
AttachSchedMonitor attaches a kprobe to the process scheduler. This hook detects the exit of a process and enables us to clean up data we associated with this process.
func (*Tracer) AttachTracer ¶
AttachTracer attaches the main tracer entry point to the perf interrupt events. The tracer entry point is always the native tracer. The native tracer will determine when to invoke the interpreter tracers based on address range information.
func (*Tracer) Close ¶
func (t *Tracer) Close()
Close provides functionality for Tracer to perform cleanup tasks. NOTE: Close may be called multiple times in succession.
func (*Tracer) EnableProfiling ¶
EnableProfiling enables the perf interrupt events with the attached eBPF programs.
func (*Tracer) StartMapMonitors ¶
StartMapMonitors starts goroutines for collecting metrics and monitoring eBPF maps for tracepoints, new traces, trace count updates and unknown PCs.
func (*Tracer) StartPIDEventProcessor ¶
StartPIDEventProcessor spawns a goroutine to process PID events.
func (*Tracer) StartProbabilisticProfiling ¶
StartProbabilisticProfiling periodically runs probabilistic profiling.
func (*Tracer) TraceProcessor ¶
func (t *Tracer) TraceProcessor() tracehandler.TraceProcessor
TraceProcessor gets the trace processor.