Skip to content
Closed
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
33 changes: 33 additions & 0 deletions tracer/tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,34 @@ func rewriteMaps(coll *cebpf.CollectionSpec, maps map[string]*cebpf.Map) error {
return nil
}

// isTracerEnabled checks if an interpreter tracer for the given map is enabled.
func isTracerEnabled(mapName string, includeTracers types.IncludedTracers) bool {
switch mapName {
case "perl_procs":
return includeTracers.Has(types.PerlTracer)
case "php_procs":
return includeTracers.Has(types.PHPTracer)
case "py_procs":
return includeTracers.Has(types.PythonTracer)
case "hotspot_procs":
return includeTracers.Has(types.HotspotTracer)
case "ruby_procs":
return includeTracers.Has(types.RubyTracer)
case "v8_procs":
return includeTracers.Has(types.V8Tracer)
case "dotnet_procs":
return includeTracers.Has(types.DotnetTracer)
case "beam_procs":
return includeTracers.Has(types.BEAMTracer)
case "go_labels_procs", "apm_int_procs":
// go_labels_procs and apm_int_procs are called from
// unwind_stop and therefore need to be available all the time.
return true
default:
return true // Not an interpreter map, so it should be loaded
}
}

// loadAllMaps loads all eBPF maps that are used in our eBPF programs.
func loadAllMaps(coll *cebpf.CollectionSpec, cfg *Config,
ebpfMaps map[string]*cebpf.Map,
Expand Down Expand Up @@ -559,6 +587,11 @@ func loadAllMaps(coll *cebpf.CollectionSpec, cfg *Config,
// Off CPU Profiling is disabled. So do not load this map.
continue
}

if !isTracerEnabled(mapName, cfg.IncludeTracers) {
log.Debugf("Skipping eBPF map %s: tracer not enabled", mapName)
continue
}
if newSize, ok := adaption[mapName]; ok {
log.Debugf("Size of eBPF map %s: %v", mapName, newSize)
mapSpec.MaxEntries = newSize
Expand Down
Loading