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

Align SpringConfigProperties with DefaultConfigProperties #12398

Conversation

jeanbisutti
Copy link
Member

@jeanbisutti jeanbisutti commented Oct 4, 2024

DefaultConfigProperties allows the user to retrieve a property value from an environment variable.

This modification allows the user to get a property value from an environment variable and from the implementation of an OTel SDK SPI declared as a bean.

@jeanbisutti jeanbisutti requested a review from a team as a code owner October 4, 2024 15:07
@jeanbisutti jeanbisutti marked this pull request as draft October 4, 2024 15:07
@github-actions github-actions bot added the test native This label can be applied to PRs to trigger them to run native tests label Oct 4, 2024
@jeanbisutti jeanbisutti force-pushed the align-spring-config-properties-with-default-config-properties branch from 5485755 to 73c31cd Compare October 4, 2024 15:21
@zeitlinger
Copy link
Member

great catch!

if (value == null && name.equals("otel.exporter.otlp.protocol")) {
String normalizedName = ConfigUtil.normalizePropertyKey(name);
String value = environment.getProperty(normalizedName, String.class);
if (value == null && normalizedName.equals("otel.exporter.otlp.protocol")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (value == null && normalizedName.equals("otel.exporter.otlp.protocol")) {
if (value == null && "otel.exporter.otlp.protocol".equals(normalizedName) {

Maybe this is better, it can avoid the influence from upstream API. The line 116 is same.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my understanding, normalizedName can't be null at this point.

I would prefer to limit the changes in this PR.

I personally agree with your suggestion.

Perhaps this change could be discussed in another PR. Feel free to create it.

@jeanbisutti jeanbisutti marked this pull request as ready for review October 7, 2024 13:38
@jeanbisutti
Copy link
Member Author

@steverao @zeitlinger Could you please have another look?

@trask trask merged commit d1ba858 into open-telemetry:main Oct 7, 2024
56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test native This label can be applied to PRs to trigger them to run native tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants