Skip to content

Rmi instrumentation on jdk17 - #4577

Merged
trask merged 4 commits into
open-telemetry:mainfrom
laurit:rmi-server-jdk17
Nov 3, 2021
Merged

Rmi instrumentation on jdk17#4577
trask merged 4 commits into
open-telemetry:mainfrom
laurit:rmi-server-jdk17

Conversation

@laurit

@laurit laurit commented Nov 3, 2021

Copy link
Copy Markdown
Contributor

Resolves #4552

@mateuszrzeszutek mateuszrzeszutek left a comment

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.

Nice 👍

@trask trask left a comment

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.

any thoughts what it would take to run the normal rmi instrumentation tests using JPMS?

Comment on lines +29 to +41
@Override
public ElementMatcher<TypeDescription> typeMatcher() {
ElementMatcher.Junction<TypeDescription> notInstrumented =
new ElementMatcher.Junction.AbstractBase<TypeDescription>() {

@Override
public boolean matches(TypeDescription target) {
return !instrumented.get();
}
};

return notInstrumented.and(nameStartsWith("sun.rmi"));
}

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.

this is a good trick to file away 😄

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I did it this way mostly because for every class that matches this gets logged

io.opentelemetry.javaagent.tooling.AgentInstaller$TransformLoggingListener - Transformed sun.rmi.server.WeakClassHashMap -- null

What I really wanted was to make this module start before RmiContextPropagationInstrumentationModule so that io.opentelemetry.javaagent.instrumentation.rmi.context.server.ContextDispatcher could access sun.rmi.server.Dispatcher. Perhaps a cleaner alternative would be to have some sort of api for declaring dependency on an internal package so this could be handled in HelperInjector.

laurit and others added 2 commits November 3, 2021 19:52
…avaagent/instrumentation/rmi/context/jpms/ExposeRmiModuleInstrumentation.java

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
@trask
trask merged commit 40ef4be into open-telemetry:main Nov 3, 2021
RashmiRam pushed a commit to RashmiRam/opentelemetry-auto-instr-java that referenced this pull request May 23, 2022
* Rmi instrumentation on jdk17

* address review comment, make muzzle happy

* Update instrumentation/rmi/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rmi/context/jpms/ExposeRmiModuleInstrumentation.java

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>

* review comment

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
@laurit
laurit deleted the rmi-server-jdk17 branch July 6, 2023 17:44
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.

Support JDK 17

3 participants