diff --git a/instrumentation/jsonrpc4j-1.6/javaagent/build.gradle.kts b/instrumentation/jsonrpc4j-1.6/javaagent/build.gradle.kts index db5746f18fa3..7f8ff07696a4 100644 --- a/instrumentation/jsonrpc4j-1.6/javaagent/build.gradle.kts +++ b/instrumentation/jsonrpc4j-1.6/javaagent/build.gradle.kts @@ -11,11 +11,11 @@ muzzle { } } -val jsonrpcVersion = "1.6" - dependencies { implementation(project(":instrumentation:jsonrpc4j-1.6:library")) - library("com.github.briandilley.jsonrpc4j:jsonrpc4j:$jsonrpcVersion") + + library("com.github.briandilley.jsonrpc4j:jsonrpc4j:1.6") + testImplementation(project(":instrumentation:jsonrpc4j-1.6:testing")) } diff --git a/instrumentation/jsonrpc4j-1.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jsonrpc4j/v1_6/JsonRpcServerInstrumentation.java b/instrumentation/jsonrpc4j-1.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jsonrpc4j/v1_6/JsonRpcServerInstrumentation.java index 74d18989e000..e1e48c9d9fde 100644 --- a/instrumentation/jsonrpc4j-1.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jsonrpc4j/v1_6/JsonRpcServerInstrumentation.java +++ b/instrumentation/jsonrpc4j-1.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jsonrpc4j/v1_6/JsonRpcServerInstrumentation.java @@ -6,6 +6,7 @@ package io.opentelemetry.javaagent.instrumentation.jsonrpc4j.v1_6; import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasClassesNamed; +import static io.opentelemetry.javaagent.instrumentation.jsonrpc4j.v1_6.JsonRpcSingletons.SERVER_INVOCATION_LISTENER; import static net.bytebuddy.matcher.ElementMatchers.isConstructor; import static net.bytebuddy.matcher.ElementMatchers.isMethod; import static net.bytebuddy.matcher.ElementMatchers.named; @@ -51,7 +52,7 @@ public static void setInvocationListener( @Advice.This JsonRpcBasicServer jsonRpcServer, @Advice.FieldValue(value = "invocationListener", readOnly = false) InvocationListener invocationListener) { - invocationListener = JsonRpcSingletons.SERVER_INVOCATION_LISTENER; + invocationListener = SERVER_INVOCATION_LISTENER; } } @@ -67,14 +68,13 @@ public static void setInvocationListener( VirtualField.find(JsonRpcBasicServer.class, Boolean.class); if (!Boolean.TRUE.equals(instrumented.get(jsonRpcServer))) { if (invocationListener == null) { - invocationListener = JsonRpcSingletons.SERVER_INVOCATION_LISTENER; + invocationListener = SERVER_INVOCATION_LISTENER; } else if (invocationListener instanceof MultipleInvocationListener) { ((MultipleInvocationListener) invocationListener) - .addInvocationListener(JsonRpcSingletons.SERVER_INVOCATION_LISTENER); + .addInvocationListener(SERVER_INVOCATION_LISTENER); } else { invocationListener = - new MultipleInvocationListener( - invocationListener, JsonRpcSingletons.SERVER_INVOCATION_LISTENER); + new MultipleInvocationListener(invocationListener, SERVER_INVOCATION_LISTENER); } instrumented.set(jsonRpcServer, true); diff --git a/instrumentation/jsonrpc4j-1.6/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/jsonrpc4j/v1_6/AgentJsonRpcTest.java b/instrumentation/jsonrpc4j-1.6/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/jsonrpc4j/v1_6/AgentJsonRpcTest.java index 26e85daf86dc..de74aa73ad38 100644 --- a/instrumentation/jsonrpc4j-1.6/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/jsonrpc4j/v1_6/AgentJsonRpcTest.java +++ b/instrumentation/jsonrpc4j-1.6/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/jsonrpc4j/v1_6/AgentJsonRpcTest.java @@ -11,7 +11,7 @@ import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; import org.junit.jupiter.api.extension.RegisterExtension; -public class AgentJsonRpcTest extends AbstractJsonRpcTest { +class AgentJsonRpcTest extends AbstractJsonRpcTest { @RegisterExtension static final InstrumentationExtension testing = AgentInstrumentationExtension.create(); diff --git a/instrumentation/jsonrpc4j-1.6/library/build.gradle.kts b/instrumentation/jsonrpc4j-1.6/library/build.gradle.kts index 1fc139a66739..f95aefe8f0fb 100644 --- a/instrumentation/jsonrpc4j-1.6/library/build.gradle.kts +++ b/instrumentation/jsonrpc4j-1.6/library/build.gradle.kts @@ -2,11 +2,10 @@ plugins { id("otel.library-instrumentation") } -val jsonrpcVersion = "1.6" val jacksonVersion = "2.13.3" dependencies { - library("com.github.briandilley.jsonrpc4j:jsonrpc4j:$jsonrpcVersion") + library("com.github.briandilley.jsonrpc4j:jsonrpc4j:1.6") implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion")