From f80d0ae1898923cdfc204344cc51b8bc8efc2cab Mon Sep 17 00:00:00 2001 From: Lauri Tulmin Date: Sat, 7 Aug 2021 08:27:21 +0300 Subject: [PATCH] Resteasy: compile instrumentation against earliest supported version (#3777) --- .../javaagent/build.gradle.kts | 18 +----------------- .../v2_0/ResteasyInjectAdapter.java | 8 +++++++- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-resteasy-3.0/javaagent/build.gradle.kts b/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-resteasy-3.0/javaagent/build.gradle.kts index b97d1dc971be..74a6df25c7d7 100644 --- a/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-resteasy-3.0/javaagent/build.gradle.kts +++ b/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-resteasy-3.0/javaagent/build.gradle.kts @@ -11,23 +11,7 @@ muzzle { } dependencies { - // compiling against a version prior to 3.0.10.Final will bind the call in ResteasyInjectAdapter: - // carrier.getHeaders().getHeaders().putSingle(key, value) - // to: - // org.jboss.resteasy.util.CaseInsensitiveMap#putSingle(Ljava/lang/String;Ljava/lang/Object;)V - // which will be incompatible with 3.0.10.Final and later, where that API was changed to: - // org.jboss.resteasy.util.CaseInsensitiveMap#putSingle(Ljava/lang/Object;Ljava/lang/Object;)V - // - // conversely, however: - // compiling against 3.0.10.Final will bind the call in ResteasyInjectAdapter: - // carrier.getHeaders().getHeaders().putSingle(key, value) - // to: - // org.jboss.resteasy.util.CaseInsensitiveMap#putSingle(Ljava/lang/Object;Ljava/lang/Object;)V - // which WILL be compatible with versions prior to 3.0.10.Final, because in those versions - // putSingle(String, Object) is a generic implementation(for) - // javax.ws.rs.core.MultivaluedMap.putSingle(K, V), and so there's also a synthetic bridge method - // putSingle(Object, Object) in those versions - library("org.jboss.resteasy:resteasy-client:3.0.10.Final") + library("org.jboss.resteasy:resteasy-client:3.0.0.Final") implementation(project(":instrumentation:jaxrs-client:jaxrs-client-2.0:jaxrs-client-2.0-common:javaagent")) } diff --git a/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-resteasy-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrsclient/v2_0/ResteasyInjectAdapter.java b/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-resteasy-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrsclient/v2_0/ResteasyInjectAdapter.java index b230c606da9f..406740eabf3d 100644 --- a/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-resteasy-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrsclient/v2_0/ResteasyInjectAdapter.java +++ b/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-resteasy-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrsclient/v2_0/ResteasyInjectAdapter.java @@ -6,6 +6,7 @@ package io.opentelemetry.javaagent.instrumentation.jaxrsclient.v2_0; import io.opentelemetry.context.propagation.TextMapSetter; +import javax.ws.rs.core.MultivaluedMap; import org.jboss.resteasy.client.jaxrs.internal.ClientInvocation; public final class ResteasyInjectAdapter implements TextMapSetter { @@ -15,6 +16,11 @@ public final class ResteasyInjectAdapter implements TextMapSetter map = carrier.getHeaders().getHeaders(); + map.putSingle(key, value); } }