-
Notifications
You must be signed in to change notification settings - Fork 848
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
Add env var substitution support to file configuration #5914
Add env var substitution support to file configuration #5914
Conversation
Codecov ReportAll modified lines are covered by tests ✅
... and 19 files with indirect coverage changes 📢 Thoughts on this report? Let us know!. |
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.
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", |
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.
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.
...r/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/ConfigurationReader.java
Show resolved
Hide resolved
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.
👍
Do you think it'd make sense to add sth like ${sys:otel.traces.exporter}
for system properties as well?
I think we probably should @mateuszrzeszutek. Opened #5926 to discuss and track. |
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.