From ff1cf4701de1816bf6b1814ea175b6dd86b5b0e2 Mon Sep 17 00:00:00 2001 From: Derek Brown Date: Mon, 2 Oct 2023 13:11:57 -0700 Subject: [PATCH 1/2] [windows] fix startup with empty api key Previous PR introduced a dependency on the trace agent config component. The Windows agent expects to be able to start (with errors in the log etc.) to be able to start even without a valid api key. With the new dependency on the trace config, make the trace component, on windows, able to initialize so that the Windows agent can start accordingly --- comp/trace/config/config.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/comp/trace/config/config.go b/comp/trace/config/config.go index 23cab4bcf13056..f9f39e2769bfc5 100644 --- a/comp/trace/config/config.go +++ b/comp/trace/config/config.go @@ -9,6 +9,7 @@ import ( "fmt" "html" "net/http" + "runtime" "strings" "testing" @@ -44,7 +45,13 @@ type cfg struct { func newConfig(deps dependencies) (Component, error) { tracecfg, err := setupConfig(deps, "") if err != nil { - return nil, err + // The windows agent has a requirement that it can successfully start + // with an invalid config. The `tracecfg` object is initialized with + // various defaults, that allow it to be "good enough". On Windows, + // allow us to return the minimal config rather than failing startup + if runtime.GOOS != "windows" || tracecfg == nil { + return nil, err + } } c := cfg{ From 7fd41bd0fa5c269db3c1cf8c1e84c6e70d151c71 Mon Sep 17 00:00:00 2001 From: Derek Brown Date: Tue, 3 Oct 2023 13:40:44 -0700 Subject: [PATCH 2/2] remove erroneous log statements --- .../common/rspec_datadog/spec_helper.rb | 29 ------------------- 1 file changed, 29 deletions(-) diff --git a/test/kitchen/test/integration/common/rspec_datadog/spec_helper.rb b/test/kitchen/test/integration/common/rspec_datadog/spec_helper.rb index 29a17ddc0a896e..55127cfe5b1411 100644 --- a/test/kitchen/test/integration/common/rspec_datadog/spec_helper.rb +++ b/test/kitchen/test/integration/common/rspec_datadog/spec_helper.rb @@ -153,9 +153,6 @@ def stop(flavor) end end wait_until_service_stopped(service) - if result == nil || result == false - log_trace "datadog-agent", "stop" - end result end @@ -174,9 +171,6 @@ def start(flavor) end end wait_until_service_started(service) - if result == nil || result == false - log_trace "datadog-agent", "start" - end result end @@ -210,32 +204,9 @@ def restart(flavor) wait_until_service_started(service, 5) end end - if result == nil || result == false - log_trace "datadog-agent", "restart" - end result end -def log_trace(flavor, action) - service = get_service_name(flavor) - if os == :windows - if action == "stop" || action == "restart" - system "wevtutil qe System /q:\"*[System[(EventID=7040) and (EventData[Data[@Name='param1']='#{service}'])]\"" - end - if action == "start" || action == "restart" - system "wevtutil qe System /q:\"*[System[(EventID=7036) and (EventData[Data[@Name='param1']='#{service}'])]\"" - end - else - if has_systemctl - system "sudo journalctl -u #{service} -xe --no-pager" - elsif has_upstart - system "sudo grep #{service} /var/log/upstart" - else - system "sudo grep #{service} /var/log/message" - end - end -end - def has_systemctl system('command -v systemctl 2>&1 > /dev/null') end