Skip to content

Commit 235cc7a

Browse files
committed
[review-fix 1] Preserve traceroute defaults and hide baseline flag
- register explicit traceroute before platform default modules are selected - keep the baseline rollout setting internal and omit it from generated examples - cover the Windows injector dependency for explicit traceroute Source: Codex review thread and maintainer direction Validation: bazel test //pkg/system-probe/config:config_test; dda inv schema.lint; dda inv schema.template-all; git diff --check
1 parent 757b8ce commit 235cc7a

5 files changed

Lines changed: 18 additions & 32 deletions

File tree

pkg/config/example/datadog-agent_linux.yaml.example

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2216,17 +2216,6 @@ api_key:
22162216
#
22172217
# enabled: true
22182218

2219-
# # @param baseline_tests - custom object - optional
2220-
# # Configuration for included baseline Network Path Dynamic Tests.
2221-
#
2222-
# baseline_tests:
2223-
2224-
# # @param enabled - boolean - optional - default: false
2225-
# # @env DD_NETWORK_PATH_CONNECTIONS_MONITORING_BASELINE_TESTS_ENABLED - boolean - optional - default: false
2226-
# # Enables up to three included Network Path Dynamic Tests every 30 minutes when Cloud Network Monitoring is enabled.
2227-
#
2228-
# enabled: true
2229-
22302219
# # @param collector - custom object - optional
22312220
# # Configuration related to Network Path Collector used for Network Path Dynamic Test
22322221
# # to monitor network traffic connections on the host.

pkg/config/example/datadog-agent_windows.yaml.example

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2231,17 +2231,6 @@ api_key:
22312231
#
22322232
# enabled: true
22332233

2234-
# # @param baseline_tests - custom object - optional
2235-
# # Configuration for included baseline Network Path Dynamic Tests.
2236-
#
2237-
# baseline_tests:
2238-
2239-
# # @param enabled - boolean - optional - default: false
2240-
# # @env DD_NETWORK_PATH_CONNECTIONS_MONITORING_BASELINE_TESTS_ENABLED - boolean - optional - default: false
2241-
# # Enables up to three included Network Path Dynamic Tests every 30 minutes when Cloud Network Monitoring is enabled.
2242-
#
2243-
# enabled: true
2244-
22452234
# # @param collector - custom object - optional
22462235
# # Configuration related to Network Path Collector used for Network Path Dynamic Test
22472236
# # to monitor network traffic connections on the host.

pkg/config/schema/yaml/core_schema.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,16 +1726,15 @@ properties:
17261726
baseline_tests:
17271727
node_type: section
17281728
type: object
1729-
visibility: public
17301729
description: Configuration for included baseline Network Path Dynamic Tests.
17311730
properties:
17321731
enabled:
17331732
node_type: setting
17341733
type: boolean
17351734
default: false
1736-
visibility: public
1737-
description: Enables up to three included Network Path Dynamic Tests every
1738-
30 minutes when Cloud Network Monitoring is enabled.
1735+
description: Enables up to three included Network Path Dynamic Tests immediately
1736+
for the first eligible snapshot, then every 30 minutes, when Cloud Network
1737+
Monitoring is enabled.
17391738
example: 'true'
17401739
collector:
17411740
node_type: section

pkg/system-probe/config/config.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,11 @@ func load() (*types.Config, error) {
182182
if cfg.GetBool(pngNS("enabled")) {
183183
c.EnabledModules[PingModule] = struct{}{}
184184
}
185+
// Keep explicit traceroute activation with the other explicit modules so
186+
// platform default modules can observe it below.
187+
if cfg.GetBool(tracerouteNS("enabled")) {
188+
c.EnabledModules[TracerouteModule] = struct{}{}
189+
}
185190
if cfg.GetBool(discoveryNS("enabled")) {
186191
c.EnabledModules[DiscoveryModule] = struct{}{}
187192
}
@@ -241,7 +246,7 @@ func load() (*types.Config, error) {
241246
// activate traceroute even when system-probe was not explicitly enabled.
242247
c.Enabled = len(c.EnabledModules) > 0
243248
cfg.Set(spNS("enabled"), c.Enabled, pkgconfigmodel.SourceAgentRuntime)
244-
if cfg.GetBool(tracerouteNS("enabled")) || npconfig.ResolveDynamicTestsState(coreCfg, cfg) != npconfig.DynamicTestsOff {
249+
if npconfig.ResolveDynamicTestsState(coreCfg, cfg) != npconfig.DynamicTestsOff {
245250
c.EnabledModules[TracerouteModule] = struct{}{}
246251
}
247252
c.Enabled = len(c.EnabledModules) > 0

pkg/system-probe/config/config_test.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,17 +166,18 @@ func TestEnableDiscovery(t *testing.T) {
166166

167167
func TestTracerouteModuleDynamicTestsState(t *testing.T) {
168168
tests := []struct {
169-
name string
170-
core map[string]any
171-
sysprobe map[string]any
172-
wantEnable bool
169+
name string
170+
core map[string]any
171+
sysprobe map[string]any
172+
wantEnable bool
173+
checkDefaultInjector bool
173174
}{
174175
{name: "baseline disabled has no impact", core: map[string]any{"network_path.connections_monitoring.baseline_tests.enabled": false}, sysprobe: map[string]any{"system_probe_config.enabled": true, "network_config.enabled": true}},
175176
{name: "baseline outside CNM", core: map[string]any{"network_path.connections_monitoring.baseline_tests.enabled": true}, sysprobe: map[string]any{"system_probe_config.enabled": true, "network_config.enabled": false}},
176177
{name: "effective baseline with implicit system probe", core: map[string]any{"network_path.connections_monitoring.baseline_tests.enabled": true}, sysprobe: map[string]any{"network_config.enabled": true}, wantEnable: true},
177178
{name: "effective baseline", core: map[string]any{"network_path.connections_monitoring.baseline_tests.enabled": true}, sysprobe: map[string]any{"system_probe_config.enabled": true, "network_config.enabled": true}, wantEnable: true},
178179
{name: "effective standard", core: map[string]any{"network_path.connections_monitoring.enabled": true}, sysprobe: map[string]any{"system_probe_config.enabled": true, "network_config.enabled": true}, wantEnable: true},
179-
{name: "explicit traceroute remains supported", sysprobe: map[string]any{"traceroute.enabled": true}, wantEnable: true},
180+
{name: "explicit traceroute remains supported", sysprobe: map[string]any{"traceroute.enabled": true}, wantEnable: true, checkDefaultInjector: true},
180181
}
181182
for _, tt := range tests {
182183
t.Run(tt.name, func(t *testing.T) {
@@ -191,6 +192,9 @@ func TestTracerouteModuleDynamicTestsState(t *testing.T) {
191192
cfg, err := New("/doesnotexist", "")
192193
require.NoError(t, err)
193194
assert.Equal(t, tt.wantEnable, cfg.ModuleIsEnabled(TracerouteModule))
195+
if tt.checkDefaultInjector && runtime.GOOS == "windows" {
196+
assert.True(t, cfg.ModuleIsEnabled(InjectorModule), "explicit traceroute should enable the default injector module")
197+
}
194198
})
195199
}
196200
}

0 commit comments

Comments
 (0)