Skip to content
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

Merged
merged 2 commits into from
Oct 23, 2023

Conversation

jack-berg
Copy link
Member

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.

@jack-berg jack-berg requested a review from a team October 13, 2023 19:35
@codecov
Copy link

codecov bot commented Oct 13, 2023

Codecov Report

All modified lines are covered by tests ✅

Files Coverage Δ
...ion/incubator/fileconfig/ConfigurationFactory.java 76.19% <ø> (ø)
...sion/incubator/fileconfig/ConfigurationReader.java 100.00% <100.00%> (ø)

... and 19 files with indirect coverage changes

📢 Thoughts on this report? Let us know!.

Copy link
Contributor

@breedx-splk breedx-splk left a 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",
Copy link
Contributor

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.

Copy link
Member

@mateuszrzeszutek mateuszrzeszutek left a 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?

@jack-berg
Copy link
Member Author

I think we probably should @mateuszrzeszutek. Opened #5926 to discuss and track.

@jack-berg jack-berg merged commit e592d5d into open-telemetry:main Oct 23, 2023
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants