Add instrumentation for jaxws metro 3.0+#9705
Merged
Merged
Conversation
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.
Contributor
Author
|
The test failure for testLatestDeps2 is unrelated to the changes in this PR.. |
laurit
reviewed
Oct 19, 2023
laurit
reviewed
Oct 23, 2023
laurit
reviewed
Oct 23, 2023
Contributor
|
@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 |
laurit
reviewed
Oct 23, 2023
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
Contributor
Author
|
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
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
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.2tojaxws-metro-2.2since "jaxws-2.0" is specific to Java EE.MetroServerSpanNamingtoMetroServerSpanNameUpdater, 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.2tojaxws-2.0-metro-2.2-testingjaxws-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-testingmodule 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/javaagentjaxws-2.0-common-testingjaxws-2.0-metro-2.2-testingjaxws-3.0-common-testingjaxws-3.0-metro-2.2-testingRegarding the implementation of
MetroServerSpanNameUpdater, I originally added compile time dependencies on bothjakarta.servlet-apiandjavax.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
@WebServicelevel.