-
Notifications
You must be signed in to change notification settings - Fork 101
Embedded OTel Collector Config #1314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
19ac8d1
69b27ae
4206ac1
ee804c8
51c5847
a3e0e8f
b9f0e8f
967f8f0
b781470
977601b
754ee59
c6391a8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -71,7 +71,11 @@ func createConverterFactories() []confmap.ConverterFactory { | |||||
| } | ||||||
|
|
||||||
| func createURIs(cfg *config.Config) []string { | ||||||
| return []string{cfg.Collector.ConfigPath} | ||||||
| configFiles := []string{cfg.Collector.ConfigPath} | ||||||
| configFiles = slices.Concat(configFiles, cfg.Collector.AdditionalPaths) | ||||||
| slog.Info("Additional config files:", "", configFiles) | ||||||
|
||||||
| slog.Info("Additional config files:", "", configFiles) | |
| slog.Info("Merging additional OTel config files", "config_files", configFiles) |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -63,6 +63,7 @@ allowed_directories: | |||||
| - /var/run/nginx | ||||||
| - /usr/share/nginx/modules | ||||||
| - /var/log/nginx | ||||||
| - /configs | ||||||
|
|
||||||
| command: | ||||||
| server: | ||||||
|
|
@@ -94,6 +95,9 @@ auxiliary_command: | |||||
|
|
||||||
| collector: | ||||||
| config_path: "/etc/nginx-agent/nginx-agent-otelcol.yaml" | ||||||
| additional_config_paths: | ||||||
| - "/configs/my_config.yaml" | ||||||
| - /etc/nginx-agent/nginx-agent-otelcol.yaml | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be commented?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's without the quotes because I wanted to check it would work with and without the quotes |
||||||
| receivers: | ||||||
| otlp: | ||||||
| "default": | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -105,13 +105,14 @@ type ( | |||||
| } | ||||||
|
|
||||||
| Collector struct { | ||||||
| ConfigPath string `yaml:"config_path" mapstructure:"config_path"` | ||||||
| Log *Log `yaml:"log" mapstructure:"log"` | ||||||
| Exporters Exporters `yaml:"exporters" mapstructure:"exporters"` | ||||||
| Extensions Extensions `yaml:"extensions" mapstructure:"extensions"` | ||||||
| Processors Processors `yaml:"processors" mapstructure:"processors"` | ||||||
| Pipelines Pipelines `yaml:"pipelines" mapstructure:"pipelines"` | ||||||
| Receivers Receivers `yaml:"receivers" mapstructure:"receivers"` | ||||||
| ConfigPath string `yaml:"config_path" mapstructure:"config_path"` | ||||||
| AdditionalPaths []string `yaml:"additional_config_paths" mapstructure:"additional_config_paths"` | ||||||
|
||||||
| AdditionalPaths []string `yaml:"additional_config_paths" mapstructure:"additional_config_paths"` | |
| AdditionalConfigPaths []string `yaml:"additional_config_paths" mapstructure:"additional_config_paths"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you make "/var/lib/nginx-agent/opentelemetry-collector-agent-debug.yaml" a constant?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to write the file to the location of the default YAML file if it is present?
Something like:
newFileName := "opentelemetry-collector-agent-debug.yaml"
folderPath := filepath.Dir(CollectorConfigPathKey)
DebugFilePath := filepath.Join(folderPath, newFileName)
os.WriteFile(DebugFilePath)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the ask was to put it in var/lib/nginx-agent as the user should not edit this file and that is usually where we place things which we do not want to user to modify