Add env var substitution support to file configuration#5914
Merged
Conversation
Codecov ReportAll modified lines are covered by tests ✅
... and 19 files with indirect coverage changes 📢 Thoughts on this report? Let us know!. |
breedx-splk
approved these changes
Oct 17, 2023
breedx-splk
left a comment
Contributor
There was a problem hiding this comment.
Yeah this is great. I think users are going to get a lot of mileage out of this.
| mapOf(entry("key1", "value1 value2"), entry("key2", "value2"))), | ||
| // VAR_3 is not defined in environment | ||
| Arguments.of( | ||
| "key1: ${env:VAR_3}\nkey2: value2\n", |
Contributor
There was a problem hiding this comment.
These multi-line yamls that have been collapsed into a single one-line string with \n in the middle are a bit hard to read. I think a string concat would read slightly better here.
mateuszrzeszutek
approved these changes
Oct 18, 2023
mateuszrzeszutek
left a comment
Member
There was a problem hiding this comment.
👍
Do you think it'd make sense to add sth like ${sys:otel.traces.exporter} for system properties as well?
Member
Author
|
I think we probably should @mateuszrzeszutek. Opened #5926 to discuss and track. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Environment variable substitution was one of the key parts of file configuration described in the original OTEP.
I've been holding off defining it in the file configuration spec because I've been trying to define the key parse / create operations, and it makes sense to describe environment variable substitution as a requirement of
parse.So while this isn't part of the spec yet, I will be trying to get it added as soon as possible. I think the syntax of environment variables (i.e.
${env:VARIABLE_NAME}) is the most likely thing the spec lands on since its the syntax the collector uses and it will be hard to argue that an alternative new syntax would trump consistency with the collector.