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

Ensure that netty 4.0 instrumentation is not applied to 4.1 #4626

Merged
merged 3 commits into from
Nov 11, 2021

Conversation

laurit
Copy link
Contributor

@laurit laurit commented Nov 10, 2021

Hopefully resolves #4612
Not completely sure how the linked issue happened, perhaps there are netty jars from different versions on the classpath, perhaps something else. This pr adds checking of method references to muzzle so that usages like AttributeKey::new would also be verified.

named("doConnect").and(takesArgument(0, SocketAddress.class)),
named("doConnect")
.and(takesArgument(0, SocketAddress.class))
.and(returns(named("io.netty.channel.ChannelFuture"))),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In netty 4.1 this method returns void

Copy link
Member

@trask trask left a comment

Choose a reason for hiding this comment

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

can you try adding testInstrumentation dependencies also, to cross-test the netty instrumentations against each other?

Copy link
Member

@trask trask left a comment

Choose a reason for hiding this comment

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

nice

Comment on lines 134 to +154
assertThat(references).containsKey("muzzle.TestClasses$MethodBodyAdvice$SomeImplementation");
assertMethod(
references.get("muzzle.TestClasses$MethodBodyAdvice$SomeImplementation"),
"someMethod",
"()V",
PROTECTED_OR_HIGHER,
OwnershipFlag.NON_STATIC);
assertThat(references).containsKey("muzzle.TestClasses$MethodBodyAdvice$B");
assertMethod(
references.get("muzzle.TestClasses$MethodBodyAdvice$B"),
"staticMethod",
"()V",
PROTECTED_OR_HIGHER,
OwnershipFlag.STATIC);
assertThat(references).containsKey("muzzle.TestClasses$MethodBodyAdvice$A");
assertMethod(
references.get("muzzle.TestClasses$MethodBodyAdvice$A"),
"<init>",
"()V",
PROTECTED_OR_HIGHER,
OwnershipFlag.NON_STATIC);
Copy link
Member

Choose a reason for hiding this comment

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

👍

Comment on lines +446 to +450
if (handle.getTag() == Opcodes.H_INVOKEVIRTUAL
|| handle.getTag() == Opcodes.H_INVOKESTATIC
|| handle.getTag() == Opcodes.H_INVOKESPECIAL
|| handle.getTag() == Opcodes.H_NEWINVOKESPECIAL
|| handle.getTag() == Opcodes.H_INVOKEINTERFACE) {
Copy link
Member

Choose a reason for hiding this comment

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

😬 👍

Copy link
Member

@mateuszrzeszutek mateuszrzeszutek left a comment

Choose a reason for hiding this comment

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

Nice 👍

@trask trask merged commit d53c276 into open-telemetry:main Nov 11, 2021
RashmiRam pushed a commit to RashmiRam/opentelemetry-auto-instr-java that referenced this pull request May 23, 2022
…emetry#4626)

* Enusre that netty 4.0 instrumentation is not applied to 4.1

* formatting

* cross test netty instrumentation
@laurit laurit deleted the muzzle-indy branch July 6, 2023 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants