Skip to content

Commit

Permalink
Fix collector extensions config (#870)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhurley authored Sep 26, 2024
1 parent ff2a1fb commit 011a0f9
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions internal/collector/otelcol.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,13 @@ service:
output_paths: ["{{ .Log.Path -}}"]
error_output_paths: ["{{ .Log.Path -}}"]
{{- end}}

{{- if ne .Extensions nil }}
extensions:
{{- if ne .Extensions.Health nil }}
- health_check
{{- end}}
{{- end}}
pipelines:
metrics:
receivers:
Expand Down
2 changes: 1 addition & 1 deletion internal/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ func getAgentConfig() *Config {
},
},
Extensions: Extensions{
Health: Health{
Health: &Health{
Server: &ServerConfig{
Host: "localhost",
Port: 1337,
Expand Down
2 changes: 1 addition & 1 deletion internal/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ type (
}

Extensions struct {
Health Health `yaml:"-" mapstructure:"health"`
Health *Health `yaml:"-" mapstructure:"health"`
}

Health struct {
Expand Down
2 changes: 1 addition & 1 deletion test/mock/collector/nginx-agent.conf
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ collector:
key: /tmp/key.pem
generate_self_signed_cert: true
processors:
batch:
batch: {}
exporters:
otlp_exporters:
- server:
Expand Down
2 changes: 1 addition & 1 deletion test/types/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func AgentConfig() *config.Config {
},
},
Extensions: config.Extensions{
Health: config.Health{
Health: &config.Health{
Server: &config.ServerConfig{
Host: "localhost",
Port: randomPort3,
Expand Down

0 comments on commit 011a0f9

Please sign in to comment.