From 481403f495c783423e230193c45355a54b1320a4 Mon Sep 17 00:00:00 2001 From: Amit Schendel Date: Sun, 20 Oct 2024 15:01:32 +0000 Subject: [PATCH] Removing external managed code support Signed-off-by: Amit Schendel --- cli_flags.go | 3 --- main.go | 29 +++++++++++------------------ tracer/tracer.go | 2 +- 3 files changed, 12 insertions(+), 22 deletions(-) diff --git a/cli_flags.go b/cli_flags.go index 497927d7..e4e25f76 100644 --- a/cli_flags.go +++ b/cli_flags.go @@ -82,7 +82,6 @@ type arguments struct { samplesPerSecond int sendErrorFrames bool tracers string - externallyManaged bool verboseMode bool version bool @@ -136,8 +135,6 @@ func parseArgs() (*arguments, error) { fs.StringVar(&args.tracers, "t", "all", "Shorthand for -tracers.") fs.StringVar(&args.tracers, "tracers", "all", tracersHelp) - fs.BoolVar(&args.externallyManaged, "externally-managed", false, externallyManagedHelp) - fs.BoolVar(&args.verboseMode, "v", false, "Shorthand for -verbose.") fs.BoolVar(&args.verboseMode, "verbose", false, verboseModeHelp) fs.BoolVar(&args.version, "version", false, versionHelp) diff --git a/main.go b/main.go index 31db6f59..9ce8ac3b 100644 --- a/main.go +++ b/main.go @@ -227,25 +227,18 @@ func mainWithExitCode() exitCode { metrics.Add(metrics.IDProcPIDStartupMs, metrics.MetricValue(time.Since(now).Milliseconds())) log.Debug("Completed initial PID listing") - if args.externallyManaged { - _, err := trc.GetNativeTracerEntry() - if err != nil { - return failure("Failed to get native tracer entry: %v", err) - } + // Attach our tracer to the perf event + if err := trc.AttachTracer(); err != nil { + return failure("Failed to attach to perf event: %v", err) + } + log.Info("Attached tracer program") + + if args.probabilisticThreshold < tracer.ProbabilisticThresholdMax { + trc.StartProbabilisticProfiling(mainCtx) + log.Printf("Enabled probabilistic profiling") } else { - // Attach our tracer to the perf event - if err := trc.AttachTracer(); err != nil { - return failure("Failed to attach to perf event: %v", err) - } - log.Info("Attached tracer program") - - if args.probabilisticThreshold < tracer.ProbabilisticThresholdMax { - trc.StartProbabilisticProfiling(mainCtx) - log.Printf("Enabled probabilistic profiling") - } else { - if err := trc.EnableProfiling(); err != nil { - return failure("Failed to enable perf events: %v", err) - } + if err := trc.EnableProfiling(); err != nil { + return failure("Failed to enable perf events: %v", err) } } diff --git a/tracer/tracer.go b/tracer/tracer.go index 81e354cc..fce9721f 100644 --- a/tracer/tracer.go +++ b/tracer/tracer.go @@ -1171,7 +1171,7 @@ func (t *Tracer) TraceProcessor() tracehandler.TraceProcessor { // GetNativeTracerEntry returns the file descriptor of the native tracer entry program. // This allows the client to use the fd to trigger the eBPF program using tail calls. func (t *Tracer) GetNativeTracerEntry() (int, error) { - tracerProg, ok := t.ebpfProgs["native_tracer_entry"] + tracerProg, ok := t.ebpfProgs["native_tracer_entry_kprobe"] if !ok { return 0, fmt.Errorf("entry program is not available") }