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

CXF 4.0 Instrumentation #11971

Closed
wants to merge 12 commits into from
Closed

Conversation

ammachado
Copy link

Adds CXF 4.0 instrumentation

@ammachado ammachado requested a review from a team August 8, 2024 04:33
Copy link

linux-foundation-easycla bot commented Aug 8, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

group.set("org.apache.cxf")
module.set("cxf-rt-frontend-jaxws")
versions.set("[4.0.0,)")
extraDependency("jakarta.servlet:jakarta.servlet-api:5.0.0")
Copy link
Contributor

Choose a reason for hiding this comment

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

We usually suggest to add assertInverse.set(true) here. If can't do it, it had better to add necessary comment like

// all earlier versions in maven central also pass muzzle check,

Copy link
Member

@trask trask Aug 19, 2024

Choose a reason for hiding this comment

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

(sorry, I unresolved this discussion as I wasn't clear what the resolution was, thanks)

@@ -64,7 +64,7 @@ Download
the [latest version](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar).

This package includes the instrumentation agent as well as
instrumentations for all supported libraries and all available data exporters.
instrumentation for all supported libraries and all available data exporters.
Copy link
Contributor

Choose a reason for hiding this comment

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

@theletterf could you review this change

Copy link
Author

Choose a reason for hiding this comment

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

IntelliJ complained about the grammar here, and I changed it. I have other similar changes uncommitted locally. Please advise on how to proceed.

@laurit
Copy link
Contributor

laurit commented Aug 9, 2024

Do I understand correctly that for cxf instrumentation this is copy paste from the existing code and the only change is that in https://github.com/ammachado/opentelemetry-java-instrumentation/blob/b4dd73c7e91f40add167978d8733d382bcf7bacf/instrumentation/jaxws/jaxws-3.0-cxf-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cxf/CxfServerSpanNaming.java#L12 you are using jakarta servlet api instead of the javax one?


import jakarta.servlet.ServletConfig

class TestWsServlet extends CXFNonSpringServlet {
Copy link
Member

Choose a reason for hiding this comment

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

we have been attempting to convert all of our groovy tests to java (see #7195), is there a reason these tests need to be in groovy, or could you write them in java instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

Since these tests are copy pasted from older cxf tests it is in my opinion fine to keep them in groovy.

@ammachado
Copy link
Author

Do I understand correctly that for cxf instrumentation this is copy paste from the existing code and the only change is that in https://github.com/ammachado/opentelemetry-java-instrumentation/blob/b4dd73c7e91f40add167978d8733d382bcf7bacf/instrumentation/jaxws/jaxws-3.0-cxf-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cxf/CxfServerSpanNaming.java#L12 you are using jakarta servlet api instead of the javax one?

Yes, that's correct. I can refactor the tests to Java, or even try to extract a common CXF library to improve reuse, but the original idea was just duplicate the existing instrumentation and move packages from javax to jakarta. Please let me know.

@laurit
Copy link
Contributor

laurit commented Aug 9, 2024

Yes, that's correct. I can refactor the tests to Java, or even try to extract a common CXF library to improve reuse, but the original idea was just duplicate the existing instrumentation and move packages from javax to jakarta. Please let me know.

Have a look at how this is implemented for metro. There is a separate testing module for jakarta version https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/jaxws/jaxws-3.0-metro-2.2-testing The implementation for the only class (as far as I remember) that depends on servlet api https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/jaxws/jaxws-metro-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/metro/MetroServerSpanNameUpdater.java uses reflection. Instead of reflection you could also add a compile dependency on both versions of servlet api. Use servlet api only in methods annotated with @NoMuzzle and use some sort of dynamic check to decide which method needs to be called. For a sample on how @NoMuzzle is used see https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/logback/logback-appender-1.0/library/src/main/java/io/opentelemetry/instrumentation/logback/appender/v1_0/internal/LoggingEventMapper.java
Hopefully this way you can avoid most of the copy-paste.

@laurit
Copy link
Contributor

laurit commented Aug 22, 2024

I made an alternative PR for this #12077

@ammachado
Copy link
Author

I made an alternative PR for this #12077

I saw it yesterday, @laurit. As soon as your PR is merged, I will close this one. Thanks for the help.

@ammachado
Copy link
Author

Closing this PR since #12077 was merged.

@ammachado ammachado closed this Aug 27, 2024
@ammachado ammachado deleted the cxf-4.0 branch August 27, 2024 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants