-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Config property util cleanup #15809
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
Open
zeitlinger
wants to merge
15
commits into
open-telemetry:main
Choose a base branch
from
zeitlinger:config-property-util-cleanup
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Config property util cleanup #15809
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
2ed8991
rename otel.javaagent.experimental.thread-propagation-debugger.enable…
zeitlinger c50acc5
create DeprecatedLibraryConfigPropertiesUtil
zeitlinger 376e9d1
rename otel.instrumentation.internal-reflection.enabled to otel.javaa…
zeitlinger c6172a6
fix
zeitlinger fae1b5d
fix
zeitlinger 605e7cf
fix
zeitlinger 6ff257c
fix
zeitlinger c305e0c
add otel.javaagent.internal-reflection.enabled
zeitlinger 508c0dc
rebase
zeitlinger 364451a
pr review
zeitlinger 7fd5dad
fix
zeitlinger 9467185
Merge branch 'main' into config-property-util-cleanup
zeitlinger 0ed8427
add debug util
zeitlinger 82d871c
move ConfigPropertiesUtil to javaagent-bootstrap
zeitlinger e874753
fix
zeitlinger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
19 changes: 19 additions & 0 deletions
19
...umentation-api/src/main/java/io/opentelemetry/instrumentation/api/internal/DebugUtil.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package io.opentelemetry.instrumentation.api.internal; | ||
|
|
||
| /** | ||
| * This class is internal and is hence not for public use. Its APIs are unstable and can change at | ||
| * any time. | ||
| */ | ||
| public class DebugUtil { | ||
|
|
||
| static boolean isAgentDebugEnabled() { | ||
| return Boolean.parseBoolean(SemconvStability.getString("otel.javaagent.debug")); | ||
| } | ||
|
|
||
| private DebugUtil() {} | ||
| } |
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
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
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
37 changes: 37 additions & 0 deletions
37
...opentelemetry/instrumentation/api/internal/DeprecatedLibraryConfigPropertiesUtilTest.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package io.opentelemetry.instrumentation.api.internal; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| import org.junit.jupiter.api.Test; | ||
| import org.junitpioneer.jupiter.SetEnvironmentVariable; | ||
| import org.junitpioneer.jupiter.SetSystemProperty; | ||
|
|
||
| @SuppressWarnings("deprecation") // using deprecated config property | ||
| class DeprecatedLibraryConfigPropertiesUtilTest { | ||
|
|
||
| @SetEnvironmentVariable(key = "TEST_PROPERTY_BOOLEAN", value = "false") | ||
| @SetSystemProperty(key = "test.property.boolean", value = "true") | ||
| @Test | ||
| void getBoolean_systemProperty() { | ||
| assertThat(DeprecatedLibraryConfigPropertiesUtil.getBoolean("test.property.boolean", false)) | ||
| .isTrue(); | ||
| } | ||
|
|
||
| @SetEnvironmentVariable(key = "TEST_PROPERTY_BOOLEAN", value = "true") | ||
| @Test | ||
| void getBoolean_environmentVariable() { | ||
| assertThat(DeprecatedLibraryConfigPropertiesUtil.getBoolean("test.property.boolean", false)) | ||
| .isTrue(); | ||
| } | ||
|
|
||
| @Test | ||
| void getBoolean_none() { | ||
| assertThat(DeprecatedLibraryConfigPropertiesUtil.getBoolean("test.property.boolean", false)) | ||
| .isFalse(); | ||
| } | ||
| } |
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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 what we gain from this change.
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.
it allows the methods to be deprecated - this has caused some confusion in a previous PR
@trask fyi
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 think things are getting clearer now and we could avoid the rename and instead deprecate it saying will be removed in 3.0
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.
It's not a rename - the class is split to distinguish the cases that are deprecated from the ones we still need in the future (which are few, but it's still confusing to understand right now)
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.
which ones are these?
I looked and only found
otel.semconv-stability.opt-in?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.
direct usages
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 only needed in the future for javaagent properties then we could make a non-deprecated copy in the javaagent module (don't need it in instrumentation-api)
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.
yes that would work if we find a solution for "otel.javaagent.debug" and "otel.semconv-stability.opt-in"
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.
otel.javaagent.debugusages should be using EarlyInitAgentConfig instead of ConfigPropertiesUtil?otel.semconv-stability.opt-inif this is the only usage in the one place, then let's just hardcode get system property and get env var there, no need for normalizing logicThere 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 use
otel.javaagent.debugin intrumentation-api - but we can make a dedicated copy for that as well - I'll try that out.