Skip to content

Commit

Permalink
Add default collector config
Browse files Browse the repository at this point in the history
  • Loading branch information
dhurley committed Oct 11, 2024
1 parent c25a931 commit 582031b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions internal/collector/otelcol.tmpl
Original file line number Diff line number Diff line change
@@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down
7 changes: 3 additions & 4 deletions test/config/agent/nginx-agent-otel-load.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions test/load/nginx_agent_process_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 582031b

Please sign in to comment.