-
Notifications
You must be signed in to change notification settings - Fork 870
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 instrumentation for jaxws metro 3.0+ #9705
Merged
Merged
Conversation
This file contains 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
Previously, only jaxws metro 2.2 was instrumented, which only worked with Java EE (javax namespace). Now, jaxws metro 3.0+ is also instrumented, which works with Jakarta EE (jakarta namespace). Rather than copy/pasting the metro 2.2 instrumentation implementation to a new metro 3.0 module, I made the existing module able to work with both Java EE and Jakarta EE classes. More specifically, I * moved the instrumentation implementation from `jaxws-2.0-metro-2.2` to `jaxws-metro-2.2` since "jaxws-2.0" is specific to Java EE. * Renamed `MetroServerSpanNaming` to `MetroServerSpanNameUpdater`, and made it work with both Java EE and Jakarta EE based on what is available on the runtime classpath. * moved the Java EE specific tests from `jaxws-2.0-metro-2.2` to `jaxws-2.0-metro-2.2-testing` * added new Jakarta EE specific tests in `jaxws-3.0-metro-2.2-testing`. This is basically a copy/paste of the tests from `jaxws-2.0-metro-2.2-testing`, but using Jakarta EE namespacing. * added the `jaxws-3.0-common-testing` module for reusable Jakarta EE tests for other future jaxws instrumentation implementations. This is basically a copy/paste of `jaxws-2.0-common-testing`, but using Jakarta EE namespacing. Regarding the implementation of `MetroServerSpanNameUpdater`, I originally added compile time dependencies on both `jakarta.servlet-api` and `javax.servlet-api`, and referenced both of their classes directly in the code, although guarded to make sure things would still work if they weren't on the runtime classpath. Unfortunately, muzzle would disable the instrumentation if either was not found at runtime. Therefore, I had to refactor the code a bit to only use reflection to access the classes. This way muzzle won't disable the instrumentation if either is not found. This is related to open-telemetry#9569, but specific to the metro runtime, rather than at the annotated `@WebService` level.
The test failure for testLatestDeps2 is unrelated to the changes in this PR..
|
laurit
reviewed
Oct 19, 2023
...c/main/java/io/opentelemetry/javaagent/instrumentation/metro/MetroServerSpanNameUpdater.java
Outdated
Show resolved
Hide resolved
laurit
reviewed
Oct 23, 2023
instrumentation/jaxws/jaxws-2.0-metro-2.2-testing/build.gradle.kts
Outdated
Show resolved
Hide resolved
laurit
reviewed
Oct 23, 2023
instrumentation/jaxws/jaxws-3.0-common-testing/build.gradle.kts
Outdated
Show resolved
Hide resolved
@philsttr See https://scans.gradle.com/s/rne277nvrcpo6/tests/task/:instrumentation:jaxws:jaxws-2.0-metro-2.2-testing:test/details/MetroJaxWsTest?top-execution=1 for the case of the test failure with jdk8. You probably need Lines 21 to 23 in 7496a8d
|
laurit
reviewed
Oct 23, 2023
instrumentation/jaxws/jaxws-metro-2.2/javaagent/build.gradle.kts
Outdated
Show resolved
Hide resolved
laurit
approved these changes
Oct 23, 2023
Tests were moved to other submodules, so the test config is no longer needed in jaxws-metro-2.2
What is the next step to get this merged? |
Abhishekkr3003
pushed a commit
to Abhishekkr3003/opentelemetry-java-instrumentation
that referenced
this pull request
Nov 7, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Previously, only jaxws metro 2.2 was instrumented, which only worked with Java EE (javax namespace). Now, jaxws metro 3.0+ is also instrumented, which works with Jakarta EE (jakarta namespace).
Rather than copy/pasting the metro 2.2 instrumentation implementation to a new metro 3.0 module, I made the existing module able to work with both Java EE and Jakarta EE classes.
More specifically, I
jaxws-2.0-metro-2.2
tojaxws-metro-2.2
since "jaxws-2.0" is specific to Java EE.MetroServerSpanNaming
toMetroServerSpanNameUpdater
, and made it work with both Java EE and Jakarta EE based on what is available on the runtime classpath.jaxws-2.0-metro-2.2
tojaxws-2.0-metro-2.2-testing
jaxws-3.0-metro-2.2-testing
. This is basically a copy/paste of the tests fromjaxws-2.0-metro-2.2-testing
, but using Jakarta EE namespacing.jaxws-3.0-common-testing
module for reusable Jakarta EE tests for other future jaxws instrumentation implementations. This is basically a copy/paste ofjaxws-2.0-common-testing
, but using Jakarta EE namespacing.The end result is the following submodules:
jaxws-metro-2.2/javaagent
jaxws-2.0-common-testing
jaxws-2.0-metro-2.2-testing
jaxws-3.0-common-testing
jaxws-3.0-metro-2.2-testing
Regarding the implementation of
MetroServerSpanNameUpdater
, I originally added compile time dependencies on bothjakarta.servlet-api
andjavax.servlet-api
, and referenced both of their classes directly in the code, although guarded to make sure things would still work if they weren't on the runtime classpath. Unfortunately, muzzle would disable the instrumentation if either was not found at runtime. Therefore, I had to refactor the code a bit to only use reflection to access the classes. This way muzzle won't disable the instrumentation if either is not found.This is related to #9569, but specific to the metro runtime, rather than at the annotated
@WebService
level.