Skip to content

CXF 4.0 Instrumentation#11971

Closed
ammachado wants to merge 12 commits into
open-telemetry:mainfrom
ammachado:cxf-4.0
Closed

CXF 4.0 Instrumentation#11971
ammachado wants to merge 12 commits into
open-telemetry:mainfrom
ammachado:cxf-4.0

Conversation

@ammachado

Copy link
Copy Markdown

Adds CXF 4.0 instrumentation

@ammachado ammachado requested a review from a team August 8, 2024 04:33
@linux-foundation-easycla

linux-foundation-easycla Bot commented Aug 8, 2024

Copy link
Copy Markdown

CLA Signed

The committers listed above are authorized under a signed CLA.

@github-actions github-actions Bot requested a review from theletterf August 8, 2024 04:34
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
Copy Markdown
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,

@trask trask Aug 19, 2024

Copy link
Copy Markdown
Member

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)

Comment thread README.md

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
Copy Markdown
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
Copy Markdown
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

laurit commented Aug 9, 2024

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

laurit commented Aug 9, 2024

Copy link
Copy Markdown
Contributor

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

laurit commented Aug 22, 2024

Copy link
Copy Markdown
Contributor

I made an alternative PR for this #12077

@ammachado

Copy link
Copy Markdown
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
Copy Markdown
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