From 582031b902d06be0f74398d5e9960f9b53abf34b Mon Sep 17 00:00:00 2001 From: dhurley Date: Fri, 11 Oct 2024 13:30:53 +0100 Subject: [PATCH] Add default collector config --- internal/collector/otelcol.tmpl | 4 ++-- test/config/agent/nginx-agent-otel-load.conf | 7 +++---- test/load/nginx_agent_process_collector.go | 6 ++++++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/internal/collector/otelcol.tmpl b/internal/collector/otelcol.tmpl index 44b454ab8e..acbe8df7c8 100644 --- a/internal/collector/otelcol.tmpl +++ b/internal/collector/otelcol.tmpl @@ -1,5 +1,5 @@ receivers: -{{- if ne .Receivers.HostMetrics.CollectionInterval 0 }} +{{- if ne .Receivers.HostMetrics nil }} hostmetrics: collection_interval: {{ .Receivers.HostMetrics.CollectionInterval }} initial_delay: {{ .Receivers.HostMetrics.InitialDelay }} @@ -148,7 +148,7 @@ service: pipelines: metrics: receivers: - {{- if ne .Receivers.HostMetrics.CollectionInterval 0 }} + {{- if ne .Receivers.HostMetrics nil }} - hostmetrics {{- end }} {{- range $index, $otlpReceiver := .Receivers.OtlpReceivers }} diff --git a/test/config/agent/nginx-agent-otel-load.conf b/test/config/agent/nginx-agent-otel-load.conf index 8b4fce50bf..f2a2269cff 100644 --- a/test/config/agent/nginx-agent-otel-load.conf +++ b/test/config/agent/nginx-agent-otel-load.conf @@ -23,10 +23,9 @@ client: collector: receivers: otlp_receivers: - - server: - host: "127.0.0.1" - port: 4317 - type: 0 + - server: + host: "127.0.0.1" + port: 4317 processors: batch: {} exporters: diff --git a/test/load/nginx_agent_process_collector.go b/test/load/nginx_agent_process_collector.go index 45de33a5c3..6293b7849d 100644 --- a/test/load/nginx_agent_process_collector.go +++ b/test/load/nginx_agent_process_collector.go @@ -244,6 +244,12 @@ func (cp *agentProcessCollector) Stop() (stopped bool, err error) { cp.isStopped = true + out, catError := exec.Command("cat", "/var/log/nginx-agent/agent.log").Output() + if catError != nil { + log.Println("Error reading /var/log/nginx-agent/agent.log: %w", catError) + } + log.Printf("\nNGINX agent logs:\n%s\n", out) + log.Printf("Gracefully terminating %s pid=%d, sending SIGTEM...", cp.name, cp.cmd.Process.Pid) // Notify resource monitor to stop.