-
Notifications
You must be signed in to change notification settings - Fork 1k
Add system properties bridge #15339
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
base: main
Are you sure you want to change the base?
Add system properties bridge #15339
Conversation
|
@trask I really like this new bridge based on your idea 😄 |
3a9e285 to
9ae95f1
Compare
...on-api/src/main/java/io/opentelemetry/instrumentation/api/internal/ConfigPropertiesUtil.java
Outdated
Show resolved
Hide resolved
...on-api/src/main/java/io/opentelemetry/instrumentation/api/internal/ConfigPropertiesUtil.java
Outdated
Show resolved
Hide resolved
...on-api/src/main/java/io/opentelemetry/instrumentation/api/internal/ConfigPropertiesUtil.java
Show resolved
Hide resolved
| /** Returns true if the given OpenTelemetry instance supports Declarative Config. */ | ||
| public static boolean isDeclarativeConfig(OpenTelemetry openTelemetry) { | ||
| return isIncubator && openTelemetry instanceof ExtendedOpenTelemetry; | ||
| } | ||
|
|
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.
is isIncubator needed, since instrumentation-api (unfortunately) already depends on the api-incubator?
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.
only for the test (see last comment)
0138d4f to
16e62ea
Compare
|
I have no idea what could have caused this failure: |
CrashEarlyJdk8 fails when you use lambdas too early in the agent initalization. |
thank you! |
|
@trask please check again |
cf18ce0 to
18d719d
Compare
...va/io/opentelemetry/instrumentation/awssdk/v2_2/internal/AbstractAwsSdkTelemetryFactory.java
Outdated
Show resolved
Hide resolved
|
@trask I've split the PR - please have another look |
...ap/src/main/java/io/opentelemetry/javaagent/bootstrap/servlet/ExperimentalSnippetHolder.java
Outdated
Show resolved
Hide resolved
...sting/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2ClientTest.java
Outdated
Show resolved
Hide resolved
...va/io/opentelemetry/instrumentation/awssdk/v2_2/internal/AbstractAwsSdkTelemetryFactory.java
Outdated
Show resolved
Hide resolved
| .orElse(false)) | ||
| .setMessagingReceiveInstrumentationEnabled( | ||
| ConfigPropertiesUtil.getBoolean( | ||
| openTelemetry, "messaging", "experimental", "receive_telemetry", "enabled") |
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.
and here
"messaging", "receive_telemetry/development", "enabled"
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, I think so.
We'd also need to add this translation to the declarative config bridge - but we can first add it here
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.
We have these cases - and both are currently used about equally as much:
experimental-foo->foo/developmentexperimental.foo->foo/development
We can't translate back from foo/development - unless we try multiple properties - and that gets harder to troubleshoot.
(this is why the tests are failing)
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.
just realized that we can just map all system properties with "otel." prefix to the corresponding declarative config value - and thus avoid the problem.
I think this is similar to what you suggested @trask
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.
No, we can treat - like ., because config properties treat them the same - so it should be simple:
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.
found a solution now
55146b8 to
deddaa1
Compare
…tal-foo" and "experimental.foo" that both translate to "foo/development"
…tal-foo" and "experimental.foo" that both translate to "foo/development"
2df0753 to
6c889a7
Compare
…tal-foo" and "experimental.foo" that both translate to "foo/development"
…tal-foo" and "experimental.foo" that both translate to "foo/development"
…tal-foo" and "experimental.foo" that both translate to "foo/development"
|
@trask please check again |
trask
left a comment
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.
nice
| } | ||
|
|
||
| protected abstract boolean getBoolean(String name, boolean defaultValue); | ||
| protected abstract boolean getBoolean(boolean defaultValue, String... name); |
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 we need this abstract method now that (I think) we have unified access between agent and library instrumentation?
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.
We have almost - but you can only use property customizers (for system properties) in the agent.
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'm not following why that's a problem, IIUC that happens at startup, then declarative config is backed by the result?
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.
This issue exists when NOT using declarative config:
- Agent: You can set the property using a customizer, e.g. via default properties
- Library: property is directly read from system properties or environment variables
| String result = ConfigPropertiesUtil.getString("otel.experimental.javascript-snippet"); | ||
| return result == null ? "" : result; | ||
| return ConfigPropertiesUtil.getString( | ||
| GlobalOpenTelemetry.get(), "servlet", "javascript-snippet/development") |
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.
can you add breaking label and add this to the CHANGELOG so I don't forget?
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.
Will do
| ConfigPropertiesUtil.isDeclarativeConfig(openTelemetry) | ||
| ? ConfigPropertiesUtil.getString( | ||
| openTelemetry, "common", "span_suppression_strategy/development") | ||
| .orElse(null) | ||
| : ConfigPropertiesUtil.getString( | ||
| "otel.instrumentation.experimental.span-suppression-strategy"); |
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.
can this be unified 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.
We can if we accept another breaking change (the common part)
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.
ah, I missed that, this one may be more used, can you open an issue to change it in next major version bump (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.
Will do
to bridge system properties / env vars to declarative config
Fixes #14192
Alternative implementation for #14767
Breaking Changes:
otel.experimental.javascript-snippetbecomesotel.instrumentation.servlet.experimental.javascript-snippet