Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions containers/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -1436,6 +1436,20 @@ func (c *Container) attachTlsUprobes(tracer *ebpftracer.Tracer, pid uint32) {
if p == nil {
return
}
if delay := *flags.TlsInstrumentationDelay; delay > 0 && !p.StartedAt.IsZero() {
if wait := delay - time.Since(p.StartedAt); wait > 0 {
p.tlsDelayLock.Lock()
if p.tlsDelayTimer == nil {
p.tlsDelayTimer = time.AfterFunc(wait, func() {
c.attachTlsUprobes(tracer, pid)
})
}
p.tlsDelayLock.Unlock()
return
}
}
p.tlsDelayLock.Lock()
defer p.tlsDelayLock.Unlock()
if !p.openSslUprobesChecked {
if key := tracer.AttachOpenSslUprobes(pid); key != nil {
p.addUprobeKey(*key)
Expand Down
8 changes: 8 additions & 0 deletions containers/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ type Process struct {
nodejsPrevStats *ebpftracer.NodejsStats
pythonPrevStats *ebpftracer.PythonStats

tlsDelayLock sync.Mutex
tlsDelayTimer *time.Timer

gpuUsageSamples []gpu.ProcessUsageSample

inboundHttp2Parsers map[uint64]*inboundHttp2State
Expand Down Expand Up @@ -215,6 +218,11 @@ func (p *Process) addUprobeKey(key ebpftracer.UprobeKey) {

func (p *Process) Close() {
p.cancelFunc()
p.tlsDelayLock.Lock()
if p.tlsDelayTimer != nil {
p.tlsDelayTimer.Stop()
}
p.tlsDelayLock.Unlock()
<-p.instrumentDone
p.uprobeKeysLock.Lock()
p.closed = true
Expand Down
1 change: 1 addition & 0 deletions flags/flags_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var (
JavaAsyncProfilerDelay = kingpin.Flag("java-async-profiler-delay", "Delay in seconds before starting async-profiler after JVM process is detected").Default("30s").Envar("JAVA_ASYNC_PROFILER_DELAY").Duration()
GoHeapProfilerMode = kingpin.Flag("go-heap-profiler", "Go heap profiling mode: disabled, enabled (collect from apps with profiling on), force (enable profiling in all Go apps)").Default("enabled").Envar("GO_HEAP_PROFILER").String()
InstrumentationDelay = kingpin.Flag("instrumentation-delay", "Delay before enabling Python GIL and Node.js event loop instrumentation, after a process is started").Default("30s").Envar("INSTRUMENTATION_DELAY").Duration()
TlsInstrumentationDelay = kingpin.Flag("tls-instrumentation-delay", "Delay before attaching TLS uprobes to a process, to skip short-lived processes (e.g., exec probes)").Default("5s").Envar("TLS_INSTRUMENTATION_DELAY").Duration()

SkipSystemdSystemServices = kingpin.Flag("skip-systemd-system-services", "Skip well-known systemd system containers (apt, motd, udev, etc.)").Default("true").Envar("SKIP_SYSTEMD_SYSTEM_SERVICES").Bool()

Expand Down
Loading