-
Notifications
You must be signed in to change notification settings - Fork 77
Split conf to built-in conf and user conf and merge them. #111
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
Conversation
|
Still fixing some tests on the Windows side, but the rough idea is ready for review. |
|
What's the user experience like when there's a syntax error (malformed YAML or something that doesn't pass validation)? Does it point to the specific file that has the error? (Asking because we were discussing this very thing in OTel SIG today.) |
Currently it writes out the
When in the future we need to support more config files (right now user config is all in one file), we'll need to add additional logic to map the receiver/processor/exporter ID to a certain file, and include that file path in the error message. |
79e1f30 to
041ff67
Compare
79864d6 to
106334a
Compare
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.
This is ready for review now.
There are a few TODOs as seen in the code that I'm still cleaning up on the side, while this PR is being reviewed. But it's not a GA blocker, so if the PR is ready to ship before I get there, I will send a followup PR for them instead.
fcf994f to
e1162fd
Compare
|
All unit and integration tests passed for this PR at commit |
confgenerator/testdata/valid/linux/logging-multiple_google_exporters/input.yaml
Outdated
Show resolved
Hide resolved
confgenerator/testdata/valid/linux/metrics-custom_collection_interval/input.yaml
Outdated
Show resolved
Hide resolved
733a5ca to
de3d0c3
Compare
confgenerator/confmerger.go
Outdated
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.
How are these not the same case?
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.
The code to handle them are exactly the same. Just wanna document the subtle choices we made:
- Difference between
an empty listandnil - For a non-empty list, we only overrides the whole thing instead of trying to append to the existing list.
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 don't understand the "difference". Appending to an empty list is the same as replacing it.
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.
The nil check is only for the overrides list, not for the original list now: https://github.com/GoogleCloudPlatform/ops-agent/blob/1f661798d2c136c156ec3fd45c429269fc00cfc5/confgenerator/confmerger.go#L196
confgenerator/confmerger.go
Outdated
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.
Why doesn't merging this at the pipeline level just like the other object types produce exactly the same behavior in fewer lines of code?
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.
Because of cases like:
$ cat testdata/valid/windows/metrics-turn_off_iis/input.yaml
metrics:
service:
pipelines:
default_pipeline:
receivers: [hostmetrics,mssql]
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 don't see how that is different. That looks like it would merge the same either way.
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.
If it's at the pipeline level, users would have to specify the full default_pipeline (receivers, processors, exporters), right?
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.
metrics:
processors:
metrics_filter:
type: exclude_metrics
metrics_pattern:
- agent.googleapis.com/processes/*
- agent.googleapis.com/cpu/*
service:
pipelines:
default_pipeline:
processors: [metrics_filter]
The alternative is for users to always repeat receivers:
metrics:
processors:
metrics_filter:
type: exclude_metrics
metrics_pattern:
- agent.googleapis.com/processes/*
- agent.googleapis.com/cpu/*
service:
pipelines:
default_pipeline:
receivers: [hostmetrics]
processors: [metrics_filter]
b61fecd to
1f66179
Compare
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.
We did discuss moving these into testdata and making these files symlinks to the testdata ones, to remove the special case for update_golden.
* Move string to struct. * Clean up mergeConfigs
* Add a test for overrides default pipeline's processors * Add a test for deleted config file corner case.
* Rename no_config to all-user_config_file_deleted and remove special logic * Make built-in-conf.yaml and merged-conf.yaml file locations non configurable. * Remove defaultConfig param from platformConfig and combine default-config.yaml and windows-default-config.yaml * Rename WriteConfigFile to writeConfigFile
f331a48 to
428aa74
Compare
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.
LGTM
| if err != nil { | ||
| return err | ||
| } | ||
| uc, err := ParseUnifiedConfig(data, hostInfo.OS) |
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.
Note: this change disabled config validation on Linux. Fixed in #133.
Implements b/191888008.