Skip to content

Commit

Permalink
discovery: Enable if USM is enabled (DataDog#31475)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitkyrka authored Nov 26, 2024
1 parent f39f3b4 commit dccac0b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cmd/system-probe/config/adjust_usm.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ func adjustUSM(cfg model.Config) {
applyDefault(cfg, netNS("enable_https_monitoring"), true)
applyDefault(cfg, spNS("enable_runtime_compiler"), true)
applyDefault(cfg, spNS("enable_kernel_header_download"), true)

applyDefault(cfg, discoveryNS("enabled"), true)
}

deprecateBool(cfg, netNS("enable_http_monitoring"), smNS("enable_http_monitoring"))
Expand Down
17 changes: 17 additions & 0 deletions cmd/system-probe/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,21 @@ func TestEnableDiscovery(t *testing.T) {
cfg := mock.NewSystemProbe(t)
assert.False(t, cfg.GetBool(discoveryNS("enabled")))
})

t.Run("default enabled with USM", func(t *testing.T) {
t.Setenv("DD_SYSTEM_PROBE_SERVICE_MONITORING_ENABLED", "true")

cfg := mock.NewSystemProbe(t)
Adjust(cfg)
assert.True(t, cfg.GetBool(discoveryNS("enabled")))
})

t.Run("force disabled with USM", func(t *testing.T) {
t.Setenv("DD_SYSTEM_PROBE_SERVICE_MONITORING_ENABLED", "true")
t.Setenv("DD_DISCOVERY_ENABLED", "false")

cfg := mock.NewSystemProbe(t)
Adjust(cfg)
assert.False(t, cfg.GetBool(discoveryNS("enabled")))
})
}
2 changes: 1 addition & 1 deletion pkg/config/setup/system_probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ func InitSystemProbeConfig(cfg pkgconfigmodel.Config) {
cfg.BindEnvAndSetDefault(join(ccmNS, "enabled"), false)

// Discovery config
cfg.BindEnvAndSetDefault(join(discoveryNS, "enabled"), false)
cfg.BindEnv(join(discoveryNS, "enabled"))
cfg.BindEnvAndSetDefault(join(discoveryNS, "cpu_usage_update_delay"), "60s")
cfg.BindEnvAndSetDefault(join(discoveryNS, "ignored_command_names"), []string{"chronyd", "cilium-agent", "containerd", "dhclient", "dockerd", "kubelet", "livenessprobe", "local-volume-pr", "sshd", "systemd"})
cfg.BindEnvAndSetDefault(join(discoveryNS, "ignored_services"), []string{"datadog-agent", "trace-agent", "process-agent", "system-probe", "security-agent", "datadog-cluster-agent"})
Expand Down

0 comments on commit dccac0b

Please sign in to comment.