Skip to content
Merged
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
6 changes: 5 additions & 1 deletion cmd/system-probe/modules/eventmonitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ func createEventMonitorModule(_ *sysconfigtypes.Config, deps module.FactoryDepen
}

gpucfg := gpuconfig.New()
if gpucfg.Enabled {
// Only the eBPF probes consume these events, so skip the consumer entirely
// when they are disabled. Kept in sync with the module gate in
// pkg/system-probe/config, which does not enable the event monitor for GPU
// monitoring unless the probes are enabled too.
if gpucfg.Enabled && gpucfg.EnableEBPFProbes {
err := createGPUProcessEventConsumer(evm)
if err != nil {
return nil, fmt.Errorf("cannot create event consumer for GPU: %w", err)
Expand Down
5 changes: 4 additions & 1 deletion pkg/system-probe/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ func load() (*types.Config, error) {
eudmEnabled := coreCfg.GetString("infrastructure_mode") == "end_user_device"
csmEnabled := cfg.GetBool(secNS("enabled"))
gpuEnabled := cfg.GetBool(gpuNS("enabled"))
// The GPU module only consumes process events when its eBPF probes are
// loaded, so the event monitor is only needed for that combination.
gpuEBPFProbesEnabled := gpuEnabled && cfg.GetBool(gpuNS("enable_ebpf_probes"))
diEnabled := cfg.GetBool(diNS("enabled"))
swEnabled := coreCfg.GetBool(swNS("enabled"))
discoveryServiceMapEnabled := cfg.GetBool(discoveryNS("service_map", "enabled"))
Expand All @@ -145,7 +148,7 @@ func load() (*types.Config, error) {
coreCfg.GetBool("sbom.enrichment.usage.enabled") ||
(usmEnabled && cfg.GetBool(smNS("enable_event_stream"))) ||
(c.ModuleIsEnabled(NetworkTracerModule) && cfg.GetBool(evNS("network_process.enabled"))) ||
gpuEnabled ||
gpuEBPFProbesEnabled ||
diEnabled {
c.EnabledModules[EventMonitorModule] = struct{}{}
}
Expand Down
10 changes: 9 additions & 1 deletion pkg/system-probe/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func TestEventMonitor(t *testing.T) {

for i, tc := range []struct {
cws, fim, networkEvents, gpu bool
gpuEBPFProbes bool
usmEvents bool
enabled bool
}{
Expand All @@ -34,7 +35,11 @@ func TestEventMonitor(t *testing.T) {
{cws: false, fim: true, networkEvents: true, enabled: true},
{cws: true, fim: false, networkEvents: true, enabled: true},
{cws: true, fim: true, networkEvents: true, enabled: true},
{cws: false, fim: false, networkEvents: false, gpu: true, enabled: true},
// GPU monitoring only needs the event monitor to feed its eBPF probes,
// so both settings have to be enabled for the module to be pulled in.
{cws: false, fim: false, networkEvents: false, gpu: true, gpuEBPFProbes: true, enabled: true},
{cws: false, fim: false, networkEvents: false, gpu: true, gpuEBPFProbes: false, enabled: false},
{cws: false, fim: false, networkEvents: false, gpu: false, gpuEBPFProbes: true, enabled: false},
{usmEvents: true, enabled: true},
} {
t.Run(strconv.Itoa(i), func(t *testing.T) {
Expand All @@ -44,6 +49,9 @@ func TestEventMonitor(t *testing.T) {
t.Setenv("DD_SYSTEM_PROBE_EVENT_MONITORING_NETWORK_PROCESS_ENABLED", strconv.FormatBool(tc.networkEvents))
t.Setenv("DD_SYSTEM_PROBE_NETWORK_ENABLED", strconv.FormatBool(tc.networkEvents))
t.Setenv("DD_GPU_MONITORING_ENABLED", strconv.FormatBool(tc.gpu))
// Set explicitly rather than relying on the default, which is
// subject to change as the eBPF probes are deprecated.
t.Setenv("DD_GPU_MONITORING_ENABLE_EBPF_PROBES", strconv.FormatBool(tc.gpuEBPFProbes))
t.Setenv("DD_SYSTEM_PROBE_SERVICE_MONITORING_ENABLED", strconv.FormatBool(tc.usmEvents))
t.Setenv("DD_SERVICE_MONITORING_CONFIG_ENABLE_EVENT_STREAM", strconv.FormatBool(tc.usmEvents))

Expand Down
Loading