From 862e4fd42186c7e65aeb67e099c012f7a7ca3857 Mon Sep 17 00:00:00 2001 From: Mateusz Rzeszutek Date: Mon, 30 Oct 2023 11:57:11 +0100 Subject: [PATCH 1/2] Change user_agent.original from recommended to opt-in on HTTP client spans --- .../http/HttpCommonAttributesExtractor.java | 6 ---- .../http/HttpServerAttributesExtractor.java | 6 ++++ .../HttpClientAttributesExtractorTest.java | 1 - ...entAttributesExtractorBothSemconvTest.java | 1 - ...tAttributesExtractorStableSemconvTest.java | 1 - .../ApacheHttpAsyncClientTest.java | 20 ----------- .../v4_0/AbstractApacheHttpClientTest.java | 10 +----- .../v4_3/AbstractApacheHttpClientTest.java | 35 ------------------- .../v5_0/AbstractApacheHttpClientTest.java | 4 +-- .../v2_0/AsyncHttpClientTest.java | 1 - .../src/test/groovy/JaxRsClientTest.groovy | 10 ------ .../v9_2/AbstractJettyClient9Test.java | 12 +++---- .../joddhttp/v4_2/JoddHttpTest.java | 5 +-- .../netty/v3_8/client/Netty38ClientTest.java | 6 +--- .../src/test/groovy/Netty40ClientTest.groovy | 7 +--- .../groovy/client/PlayWsClientTest.groovy | 5 --- .../AbstractReactorNettyHttpClientTest.java | 3 -- .../AbstractReactorNettyHttpClientTest.java | 4 --- .../VertxRxCircuitBreakerWebClientTest.groovy | 5 --- .../groovy/client/VertxRxWebClientTest.groovy | 5 --- .../VertxRxCircuitBreakerWebClientTest.groovy | 5 --- .../groovy/client/VertxRxWebClientTest.groovy | 5 --- .../test/base/HttpClientTest.groovy | 5 --- .../junit/http/AbstractHttpClientTest.java | 19 ++-------- .../junit/http/HttpClientTestOptions.java | 9 +---- 25 files changed, 19 insertions(+), 171 deletions(-) diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpCommonAttributesExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpCommonAttributesExtractor.java index c80bca684551..1b597e2ee6e5 100644 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpCommonAttributesExtractor.java +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpCommonAttributesExtractor.java @@ -67,7 +67,6 @@ public void onStart(AttributesBuilder attributes, Context parentContext, REQUEST if (SemconvStability.emitOldHttpSemconv()) { internalSet(attributes, SemanticAttributes.HTTP_METHOD, method); } - internalSet(attributes, SemanticAttributes.USER_AGENT_ORIGINAL, userAgent(request)); for (String name : capturedRequestHeaders) { List values = getter.getHttpRequestHeader(request, name); @@ -152,11 +151,6 @@ public void onEnd( } } - @Nullable - private String userAgent(REQUEST request) { - return firstHeaderValue(getter.getHttpRequestHeader(request, "user-agent")); - } - @Nullable private Long requestBodySize(REQUEST request) { return parseNumber(firstHeaderValue(getter.getHttpRequestHeader(request, "content-length"))); diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractor.java index 58411f67b904..ce2120e8113c 100644 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractor.java +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractor.java @@ -115,6 +115,7 @@ public void onStart(AttributesBuilder attributes, Context parentContext, REQUEST internalClientExtractor.onStart(attributes, request); internalSet(attributes, SemanticAttributes.HTTP_ROUTE, getter.getHttpRoute(request)); + internalSet(attributes, SemanticAttributes.USER_AGENT_ORIGINAL, userAgent(request)); } @Override @@ -140,4 +141,9 @@ public void onEnd( public SpanKey internalGetSpanKey() { return SpanKey.HTTP_SERVER; } + + @Nullable + private String userAgent(REQUEST request) { + return firstHeaderValue(getter.getHttpRequestHeader(request, "user-agent")); + } } diff --git a/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorTest.java index 0f0b389b3586..928137106fc9 100644 --- a/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorTest.java +++ b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorTest.java @@ -144,7 +144,6 @@ void normal() { .containsOnly( entry(SemanticAttributes.HTTP_METHOD, "POST"), entry(SemanticAttributes.HTTP_URL, "http://github.com"), - entry(SemanticAttributes.USER_AGENT_ORIGINAL, "okhttp 3.x"), entry( AttributeKey.stringArrayKey("http.request.header.custom_request_header"), asList("123", "456")), diff --git a/instrumentation-api-semconv/src/testBothHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorBothSemconvTest.java b/instrumentation-api-semconv/src/testBothHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorBothSemconvTest.java index 5137f0268928..3efedfeaab31 100644 --- a/instrumentation-api-semconv/src/testBothHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorBothSemconvTest.java +++ b/instrumentation-api-semconv/src/testBothHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorBothSemconvTest.java @@ -139,7 +139,6 @@ void normal() { entry(SemanticAttributes.HTTP_REQUEST_METHOD, "POST"), entry(SemanticAttributes.HTTP_URL, "http://github.com"), entry(SemanticAttributes.URL_FULL, "http://github.com"), - entry(SemanticAttributes.USER_AGENT_ORIGINAL, "okhttp 3.x"), entry( AttributeKey.stringArrayKey("http.request.header.custom_request_header"), asList("123", "456")), diff --git a/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorStableSemconvTest.java b/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorStableSemconvTest.java index 60c4d7f6187d..517e6e6963a4 100644 --- a/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorStableSemconvTest.java +++ b/instrumentation-api-semconv/src/testStableHttpSemconv/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorStableSemconvTest.java @@ -171,7 +171,6 @@ void normal() { .containsOnly( entry(SemanticAttributes.HTTP_REQUEST_METHOD, "POST"), entry(SemanticAttributes.URL_FULL, "http://github.com"), - entry(SemanticAttributes.USER_AGENT_ORIGINAL, "okhttp 3.x"), entry( AttributeKey.stringArrayKey("http.request.header.custom-request-header"), asList("123", "456")), diff --git a/instrumentation/apache-httpasyncclient-4.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientTest.java b/instrumentation/apache-httpasyncclient-4.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientTest.java index 14a0f55ae7af..0d5687b15714 100644 --- a/instrumentation/apache-httpasyncclient-4.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientTest.java +++ b/instrumentation/apache-httpasyncclient-4.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientTest.java @@ -9,7 +9,6 @@ import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpClientTest; import io.opentelemetry.instrumentation.testing.junit.http.HttpClientInstrumentationExtension; import io.opentelemetry.instrumentation.testing.junit.http.HttpClientResult; -import io.opentelemetry.instrumentation.testing.junit.http.HttpClientTestOptions; import java.io.IOException; import java.io.UncheckedIOException; import java.net.URI; @@ -93,11 +92,6 @@ public void sendRequestWithCallback( HttpClientResult httpClientResult) { getClient(uri).execute(request, responseCallback(httpClientResult)); } - - @Override - protected void configure(HttpClientTestOptions.Builder optionsBuilder) { - configureTest(optionsBuilder); - } } @Nested @@ -132,11 +126,6 @@ public void sendRequestWithCallback( request, responseCallback(httpClientResult)); } - - @Override - protected void configure(HttpClientTestOptions.Builder optionsBuilder) { - configureTest(optionsBuilder); - } } @Nested @@ -170,11 +159,6 @@ public void sendRequestWithCallback( request, responseCallback(httpClientResult)); } - - @Override - protected void configure(HttpClientTestOptions.Builder optionsBuilder) { - configureTest(optionsBuilder); - } } HttpUriRequest configureRequest(HttpUriRequest request, Map headers) { @@ -220,10 +204,6 @@ public void cancelled() { }; } - void configureTest(HttpClientTestOptions.Builder optionsBuilder) { - optionsBuilder.setUserAgent("httpasyncclient"); - } - static String fullPathFromUri(URI uri) { StringBuilder builder = new StringBuilder(); if (uri.getPath() != null) { diff --git a/instrumentation/apache-httpclient/apache-httpclient-4.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v4_0/AbstractApacheHttpClientTest.java b/instrumentation/apache-httpclient/apache-httpclient-4.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v4_0/AbstractApacheHttpClientTest.java index 480fd5d8876f..ed90075de0ae 100644 --- a/instrumentation/apache-httpclient/apache-httpclient-4.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v4_0/AbstractApacheHttpClientTest.java +++ b/instrumentation/apache-httpclient/apache-httpclient-4.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v4_0/AbstractApacheHttpClientTest.java @@ -7,7 +7,6 @@ import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpClientTest; import io.opentelemetry.instrumentation.testing.junit.http.HttpClientResult; -import io.opentelemetry.instrumentation.testing.junit.http.HttpClientTestOptions; import java.net.URI; import java.util.Map; import org.apache.http.HttpHost; @@ -19,17 +18,10 @@ abstract class AbstractApacheHttpClientTest extends AbstractHttpClientTest { - private static final String USER_AGENT = "apachehttpclient"; - - @Override - protected void configure(HttpClientTestOptions.Builder optionsBuilder) { - optionsBuilder.setUserAgent(USER_AGENT); - } - @Override public T buildRequest(String method, URI uri, Map headers) { T request = createRequest(method, uri); - request.addHeader("user-agent", USER_AGENT); + request.addHeader("user-agent", "apachehttpclient"); headers.forEach(request::setHeader); return request; } diff --git a/instrumentation/apache-httpclient/apache-httpclient-4.3/testing/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/AbstractApacheHttpClientTest.java b/instrumentation/apache-httpclient/apache-httpclient-4.3/testing/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/AbstractApacheHttpClientTest.java index 8299e2457c16..92cdfa33181b 100644 --- a/instrumentation/apache-httpclient/apache-httpclient-4.3/testing/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/AbstractApacheHttpClientTest.java +++ b/instrumentation/apache-httpclient/apache-httpclient-4.3/testing/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/AbstractApacheHttpClientTest.java @@ -8,7 +8,6 @@ import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpClientTest; import io.opentelemetry.instrumentation.testing.junit.http.HttpClientResult; -import io.opentelemetry.instrumentation.testing.junit.http.HttpClientTestOptions; import java.io.IOException; import java.io.UncheckedIOException; import java.net.URI; @@ -90,11 +89,6 @@ public void sendRequestWithCallback( httpClientResult.complete(t); } } - - @Override - protected void configure(HttpClientTestOptions.Builder optionsBuilder) { - configureTest(optionsBuilder); - } } @Nested @@ -136,11 +130,6 @@ public void sendRequestWithCallback( httpClientResult.complete(t); } } - - @Override - protected void configure(HttpClientTestOptions.Builder optionsBuilder) { - configureTest(optionsBuilder); - } } @Nested @@ -177,11 +166,6 @@ public void sendRequestWithCallback( httpClientResult.complete(t); } } - - @Override - protected void configure(HttpClientTestOptions.Builder optionsBuilder) { - configureTest(optionsBuilder); - } } @Nested @@ -223,11 +207,6 @@ public void sendRequestWithCallback( httpClientResult.complete(t); } } - - @Override - protected void configure(HttpClientTestOptions.Builder optionsBuilder) { - configureTest(optionsBuilder); - } } @Nested @@ -259,11 +238,6 @@ public void sendRequestWithCallback( httpClientResult.complete(t); } } - - @Override - protected void configure(HttpClientTestOptions.Builder optionsBuilder) { - configureTest(optionsBuilder); - } } @Nested @@ -295,11 +269,6 @@ public void sendRequestWithCallback( httpClientResult.complete(t); } } - - @Override - protected void configure(HttpClientTestOptions.Builder optionsBuilder) { - configureTest(optionsBuilder); - } } static T configureRequest(T request, Map headers) { @@ -331,10 +300,6 @@ static ResponseHandler responseCallback(HttpClientResult httpClien }; } - static void configureTest(HttpClientTestOptions.Builder optionsBuilder) { - optionsBuilder.setUserAgent("apachehttpclient"); - } - static String fullPathFromUri(URI uri) { StringBuilder builder = new StringBuilder(); if (uri.getPath() != null) { diff --git a/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/AbstractApacheHttpClientTest.java b/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/AbstractApacheHttpClientTest.java index 9fc8fe17bd9f..170b62f80eae 100644 --- a/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/AbstractApacheHttpClientTest.java +++ b/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/AbstractApacheHttpClientTest.java @@ -27,11 +27,9 @@ abstract class AbstractApacheHttpClientTest extends AbstractHttpClientTest { - private static final String USER_AGENT = "apachehttpclient"; @Override protected void configure(HttpClientTestOptions.Builder optionsBuilder) { - optionsBuilder.setUserAgent(USER_AGENT); optionsBuilder.setHttpAttributes(this::getHttpAttributes); } @@ -55,7 +53,7 @@ protected Set> getHttpAttributes(URI uri) { @Override public T buildRequest(String method, URI uri, Map headers) { T request = createRequest(method, uri); - request.addHeader("user-agent", USER_AGENT); + request.addHeader("user-agent", "apachehttpclient"); headers.forEach((key, value) -> request.setHeader(new BasicHeader(key, value))); return request; } diff --git a/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientTest.java b/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientTest.java index afc19d85854c..e8b25349aca9 100644 --- a/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientTest.java +++ b/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientTest.java @@ -78,6 +78,5 @@ public void onThrowable(Throwable throwable) { @Override protected void configure(HttpClientTestOptions.Builder optionsBuilder) { optionsBuilder.disableTestRedirects(); - optionsBuilder.setUserAgent("AHC"); } } diff --git a/instrumentation/jaxrs-client/jaxrs-client-2.0-testing/src/test/groovy/JaxRsClientTest.groovy b/instrumentation/jaxrs-client/jaxrs-client-2.0-testing/src/test/groovy/JaxRsClientTest.groovy index 54fd4d321914..43cdf4d74456 100644 --- a/instrumentation/jaxrs-client/jaxrs-client-2.0-testing/src/test/groovy/JaxRsClientTest.groovy +++ b/instrumentation/jaxrs-client/jaxrs-client-2.0-testing/src/test/groovy/JaxRsClientTest.groovy @@ -140,11 +140,6 @@ class JerseyClientTest extends JaxRsClientTest { return new JerseyClientBuilder().withConfig(config) } - @Override - String userAgent() { - "Jersey" - } - @Override SingleConnection createSingleConnection(String host, int port) { // Jersey JAX-RS client uses HttpURLConnection internally, which does not support pipelining nor @@ -198,11 +193,6 @@ class CxfClientTest extends JaxRsClientTest { return false } - @Override - String userAgent() { - "Apache" - } - @Override ClientBuilder builder() { return new ClientBuilderImpl() diff --git a/instrumentation/jetty-httpclient/jetty-httpclient-9.2/testing/src/main/java/io/opentelemetry/instrumentation/jetty/httpclient/v9_2/AbstractJettyClient9Test.java b/instrumentation/jetty-httpclient/jetty-httpclient-9.2/testing/src/main/java/io/opentelemetry/instrumentation/jetty/httpclient/v9_2/AbstractJettyClient9Test.java index 91c31248cf56..7099694776ef 100644 --- a/instrumentation/jetty-httpclient/jetty-httpclient-9.2/testing/src/main/java/io/opentelemetry/instrumentation/jetty/httpclient/v9_2/AbstractJettyClient9Test.java +++ b/instrumentation/jetty-httpclient/jetty-httpclient-9.2/testing/src/main/java/io/opentelemetry/instrumentation/jetty/httpclient/v9_2/AbstractJettyClient9Test.java @@ -22,8 +22,6 @@ public abstract class AbstractJettyClient9Test extends AbstractHttpClientTest { - private static final String USER_AGENT = "Jetty"; - private HttpClient client; private HttpClient httpsClient; @@ -48,18 +46,17 @@ public void after() throws Exception { @Override protected void configure(HttpClientTestOptions.Builder optionsBuilder) { - optionsBuilder.disableTestRedirects().setUserAgent(USER_AGENT); + optionsBuilder.disableTestRedirects(); } @Override - public Request buildRequest(String method, URI uri, Map headers) - throws Exception { + public Request buildRequest(String method, URI uri, Map headers) { HttpClient theClient = uri.getScheme().equalsIgnoreCase("https") ? httpsClient : client; Request request = theClient .newRequest(uri) .method(method) - .agent(USER_AGENT) + .agent("Jetty") .timeout(5000L, TimeUnit.MILLISECONDS); headers.forEach(request::header); return request; @@ -77,8 +74,7 @@ public void sendRequestWithCallback( String method, URI uri, Map headers, - HttpClientResult httpClientResult) - throws Exception { + HttpClientResult httpClientResult) { JettyClientListener jcl = new JettyClientListener(); request.onRequestFailure(jcl); request.onResponseFailure(jcl); diff --git a/instrumentation/jodd-http-4.2/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/joddhttp/v4_2/JoddHttpTest.java b/instrumentation/jodd-http-4.2/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/joddhttp/v4_2/JoddHttpTest.java index ccf4445f4921..fa6e6002b0cf 100644 --- a/instrumentation/jodd-http-4.2/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/joddhttp/v4_2/JoddHttpTest.java +++ b/instrumentation/jodd-http-4.2/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/joddhttp/v4_2/JoddHttpTest.java @@ -16,8 +16,6 @@ public class JoddHttpTest extends AbstractHttpClientTest { - private static final String USER_AGENT = "Jodd HTTP"; - @RegisterExtension static final InstrumentationExtension testing = HttpClientInstrumentationExtension.forAgent(); @@ -30,7 +28,7 @@ public HttpRequest buildRequest(String method, URI uri, Map head .followRedirects(true) .connectionKeepAlive(true) .connectionTimeout((int) CONNECTION_TIMEOUT.toMillis()) - .header("user-agent", USER_AGENT); + .header("user-agent", "Jodd HTTP"); for (Map.Entry header : headers.entrySet()) { request.headerOverwrite(header.getKey(), header.getValue()); } @@ -54,6 +52,5 @@ protected void configure(HttpClientTestOptions.Builder optionsBuilder) { optionsBuilder.disableTestCallback(); // Circular Redirects are not explicitly handled by jodd-http optionsBuilder.disableTestCircularRedirects(); - optionsBuilder.setUserAgent(USER_AGENT); } } diff --git a/instrumentation/netty/netty-3.8/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/Netty38ClientTest.java b/instrumentation/netty/netty-3.8/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/Netty38ClientTest.java index 029b2f61879f..183c796e470c 100644 --- a/instrumentation/netty/netty-3.8/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/Netty38ClientTest.java +++ b/instrumentation/netty/netty-3.8/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/Netty38ClientTest.java @@ -38,14 +38,12 @@ class Netty38ClientTest extends AbstractHttpClientTest { @RegisterExtension static final InstrumentationExtension testing = HttpClientInstrumentationExtension.forAgent(); - static final String USER_AGENT = "test-user-agent"; - AsyncHttpClient client; @BeforeEach void setUp() throws Exception { AsyncHttpClientConfig.Builder builder = - new AsyncHttpClientConfig.Builder().setUserAgent(USER_AGENT); + new AsyncHttpClientConfig.Builder().setUserAgent("test-user-agent"); Method setConnectTimeout; try { @@ -142,8 +140,6 @@ protected void configure(HttpClientTestOptions.Builder optionsBuilder) { optionsBuilder.disableTestHttps(); optionsBuilder.disableTestReadTimeout(); - optionsBuilder.setUserAgent(USER_AGENT); - optionsBuilder.setExpectedClientSpanNameMapper( (uri, method) -> { // unopened port or non routable address diff --git a/instrumentation/netty/netty-4.0/javaagent/src/test/groovy/Netty40ClientTest.groovy b/instrumentation/netty/netty-4.0/javaagent/src/test/groovy/Netty40ClientTest.groovy index 879fe1a9b225..6ee25ed8233c 100644 --- a/instrumentation/netty/netty-4.0/javaagent/src/test/groovy/Netty40ClientTest.groovy +++ b/instrumentation/netty/netty-4.0/javaagent/src/test/groovy/Netty40ClientTest.groovy @@ -78,7 +78,7 @@ class Netty40ClientTest extends HttpClientTest implement } def request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.valueOf(method), target, Unpooled.EMPTY_BUFFER) HttpHeaders.setHost(request, uri.host + ":" + uri.port) - request.headers().set("user-agent", userAgent()) + request.headers().set("user-agent", "Netty") headers.each { k, v -> request.headers().set(k, v) } return request } @@ -133,11 +133,6 @@ class Netty40ClientTest extends HttpClientTest implement return attributes } - @Override - String userAgent() { - return "Netty" - } - @Override boolean testRedirects() { false diff --git a/instrumentation/play/play-mvc/play-mvc-2.4/javaagent/src/test/groovy/client/PlayWsClientTest.groovy b/instrumentation/play/play-mvc/play-mvc-2.4/javaagent/src/test/groovy/client/PlayWsClientTest.groovy index a36b9f17a9d6..8a079de9199d 100644 --- a/instrumentation/play/play-mvc/play-mvc-2.4/javaagent/src/test/groovy/client/PlayWsClientTest.groovy +++ b/instrumentation/play/play-mvc/play-mvc-2.4/javaagent/src/test/groovy/client/PlayWsClientTest.groovy @@ -53,11 +53,6 @@ class PlayWsClientTest extends HttpClientTest implements AgentTestTra return request.execute(method) } - @Override - String userAgent() { - return "AHC" - } - @Override boolean testRedirects() { false diff --git a/instrumentation/reactor/reactor-netty/reactor-netty-0.9/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v0_9/AbstractReactorNettyHttpClientTest.java b/instrumentation/reactor/reactor-netty/reactor-netty-0.9/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v0_9/AbstractReactorNettyHttpClientTest.java index e65c95187224..62c0b32b0f86 100644 --- a/instrumentation/reactor/reactor-netty/reactor-netty-0.9/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v0_9/AbstractReactorNettyHttpClientTest.java +++ b/instrumentation/reactor/reactor-netty/reactor-netty-0.9/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v0_9/AbstractReactorNettyHttpClientTest.java @@ -41,8 +41,6 @@ abstract class AbstractReactorNettyHttpClientTest @RegisterExtension static final InstrumentationExtension testing = HttpClientInstrumentationExtension.forAgent(); - static final String USER_AGENT = "ReactorNetty"; - abstract HttpClient createHttpClient(boolean readTimeout); @Override @@ -93,7 +91,6 @@ public void sendRequestWithCallback( @SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0 protected void configure(HttpClientTestOptions.Builder optionsBuilder) { optionsBuilder.disableTestRedirects(); - optionsBuilder.setUserAgent(USER_AGENT); optionsBuilder.setExpectedClientSpanNameMapper( (uri, method) -> { diff --git a/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/AbstractReactorNettyHttpClientTest.java b/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/AbstractReactorNettyHttpClientTest.java index 3cbc97105ac6..6b5c2b65b6b2 100644 --- a/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/AbstractReactorNettyHttpClientTest.java +++ b/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/AbstractReactorNettyHttpClientTest.java @@ -44,8 +44,6 @@ abstract class AbstractReactorNettyHttpClientTest extends AbstractHttpClientTest> { - static final String USER_AGENT = "ReactorNetty"; - @RegisterExtension static final InstrumentationExtension testing = HttpClientInstrumentationExtension.forAgent(); @@ -106,7 +104,6 @@ protected void configure(HttpClientTestOptions.Builder optionsBuilder) { optionsBuilder.markAsLowLevelInstrumentation(); optionsBuilder.setMaxRedirects(52); - optionsBuilder.setUserAgent(USER_AGENT); // TODO: remove this test altogether? this scenario is (was) only implemented in reactor-netty, // all other HTTP clients worked in a different way // optionsBuilder.enableTestCallbackWithImplicitParent(); @@ -312,7 +309,6 @@ void shouldEndSpanOnMonoTimeout() { .hasAttributesSatisfyingExactly( equalTo(SemanticAttributes.HTTP_METHOD, "GET"), equalTo(SemanticAttributes.HTTP_URL, uri.toString()), - equalTo(SemanticAttributes.USER_AGENT_ORIGINAL, USER_AGENT), equalTo(SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH, 0), equalTo(SemanticAttributes.NET_PEER_NAME, "localhost"), equalTo(SemanticAttributes.NET_PEER_PORT, uri.getPort())), diff --git a/instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/latestDepTest/groovy/client/VertxRxCircuitBreakerWebClientTest.groovy b/instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/latestDepTest/groovy/client/VertxRxCircuitBreakerWebClientTest.groovy index 5eec499e3209..f646d0b14c08 100644 --- a/instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/latestDepTest/groovy/client/VertxRxCircuitBreakerWebClientTest.groovy +++ b/instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/latestDepTest/groovy/client/VertxRxCircuitBreakerWebClientTest.groovy @@ -104,11 +104,6 @@ class VertxRxCircuitBreakerWebClientTest extends HttpClientTest> return super.httpAttributes(uri) } - @Override - String userAgent() { - return "Vert.x-WebClient" - } - @Override boolean testRedirects() { false diff --git a/instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/latestDepTest/groovy/client/VertxRxWebClientTest.groovy b/instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/latestDepTest/groovy/client/VertxRxWebClientTest.groovy index 991ab1244464..4abac2d6218a 100644 --- a/instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/latestDepTest/groovy/client/VertxRxWebClientTest.groovy +++ b/instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/latestDepTest/groovy/client/VertxRxWebClientTest.groovy @@ -90,11 +90,6 @@ class VertxRxWebClientTest extends HttpClientTest> implement return super.httpAttributes(uri) } - @Override - String userAgent() { - return "Vert.x-WebClient" - } - @Override boolean testRedirects() { false diff --git a/instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/version35Test/groovy/client/VertxRxCircuitBreakerWebClientTest.groovy b/instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/version35Test/groovy/client/VertxRxCircuitBreakerWebClientTest.groovy index 57d93a01b3c6..5e33f8a8df93 100644 --- a/instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/version35Test/groovy/client/VertxRxCircuitBreakerWebClientTest.groovy +++ b/instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/version35Test/groovy/client/VertxRxCircuitBreakerWebClientTest.groovy @@ -84,11 +84,6 @@ class VertxRxCircuitBreakerWebClientTest extends HttpClientTest> } } - @Override - String userAgent() { - return "Vert.x-WebClient" - } - @Override boolean testRedirects() { false diff --git a/instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/version35Test/groovy/client/VertxRxWebClientTest.groovy b/instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/version35Test/groovy/client/VertxRxWebClientTest.groovy index 43bc4f7c7bdf..c120e5e94871 100644 --- a/instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/version35Test/groovy/client/VertxRxWebClientTest.groovy +++ b/instrumentation/vertx/vertx-rx-java-3.5/javaagent/src/version35Test/groovy/client/VertxRxWebClientTest.groovy @@ -70,11 +70,6 @@ class VertxRxWebClientTest extends HttpClientTest> implement return exception } - @Override - String userAgent() { - return "Vert.x-WebClient" - } - @Override boolean testRedirects() { false diff --git a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpClientTest.groovy b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpClientTest.groovy index dc2b9e90bbe0..0ee46050ece4 100644 --- a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpClientTest.groovy +++ b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpClientTest.groovy @@ -131,7 +131,6 @@ abstract class HttpClientTest extends InstrumentationSpecification { protected void configure(HttpClientTestOptions.Builder optionsBuilder) { optionsBuilder.setHttpAttributes(HttpClientTest.this.&httpAttributes) optionsBuilder.setResponseCodeOnRedirectError(responseCodeOnRedirectError()) - optionsBuilder.setUserAgent(HttpClientTest.this.userAgent()) optionsBuilder.setClientSpanErrorMapper(HttpClientTest.this.&clientSpanError) optionsBuilder.setSingleConnectionFactory(HttpClientTest.this.&createSingleConnection) optionsBuilder.setExpectedClientSpanNameMapper(HttpClientTest.this.&expectedClientSpanName) @@ -381,10 +380,6 @@ abstract class HttpClientTest extends InstrumentationSpecification { return 302 } - String userAgent() { - return null - } - /** A list of additional HTTP client span attributes extracted by the instrumentation per URI. */ Set> httpAttributes(URI uri) { new HashSet<>(HttpClientTestOptions.DEFAULT_HTTP_ATTRIBUTES) diff --git a/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpClientTest.java b/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpClientTest.java index f05d4e90b7f5..da88b0c63eb2 100644 --- a/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpClientTest.java +++ b/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpClientTest.java @@ -1087,22 +1087,9 @@ SpanDataAssert assertClientSpan( if (httpClientAttributes.contains(httpMethodKey)) { assertThat(attrs).containsEntry(httpMethodKey, method); } - if (httpClientAttributes.contains(SemanticAttributes.USER_AGENT_ORIGINAL)) { - String userAgent = options.getUserAgent(); - if (userAgent != null - || attrs.get(SemanticAttributes.USER_AGENT_ORIGINAL) != null) { - assertThat(attrs) - .hasEntrySatisfying( - SemanticAttributes.USER_AGENT_ORIGINAL, - actual -> { - if (userAgent != null) { - assertThat(actual).startsWith(userAgent); - } else { - assertThat(actual).isNull(); - } - }); - } - } + // opt-in, not collected by default + assertThat(attrs).doesNotContainKey(SemanticAttributes.USER_AGENT_ORIGINAL); + AttributeKey httpRequestLengthKey = getAttributeKey(SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH); if (attrs.get(httpRequestLengthKey) != null) { diff --git a/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/HttpClientTestOptions.java b/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/HttpClientTestOptions.java index bfea4a07da3e..6567b3e0a78c 100644 --- a/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/HttpClientTestOptions.java +++ b/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/HttpClientTestOptions.java @@ -33,8 +33,7 @@ public abstract class HttpClientTestOptions { SemconvStabilityUtil.getAttributeKey(SemanticAttributes.NET_PEER_NAME), SemconvStabilityUtil.getAttributeKey(SemanticAttributes.NET_PEER_PORT), SemconvStabilityUtil.getAttributeKey(SemanticAttributes.HTTP_URL), - SemconvStabilityUtil.getAttributeKey(SemanticAttributes.HTTP_METHOD), - SemconvStabilityUtil.getAttributeKey(SemanticAttributes.USER_AGENT_ORIGINAL)))); + SemconvStabilityUtil.getAttributeKey(SemanticAttributes.HTTP_METHOD)))); public static final BiFunction DEFAULT_EXPECTED_CLIENT_SPAN_NAME_MAPPER = (uri, method) -> HttpConstants._OTHER.equals(method) ? "HTTP" : method; @@ -46,9 +45,6 @@ public abstract class HttpClientTestOptions { @Nullable public abstract Integer getResponseCodeOnRedirectError(); - @Nullable - public abstract String getUserAgent(); - public abstract BiFunction getClientSpanErrorMapper(); /** @@ -108,7 +104,6 @@ public interface Builder { default Builder withDefaults() { return setHttpAttributes(x -> DEFAULT_HTTP_ATTRIBUTES) .setResponseCodeOnRedirectError(FOUND_STATUS_CODE) - .setUserAgent(null) .setClientSpanErrorMapper((uri, exception) -> exception) .setSingleConnectionFactory((host, port) -> null) .setExpectedClientSpanNameMapper(DEFAULT_EXPECTED_CLIENT_SPAN_NAME_MAPPER) @@ -133,8 +128,6 @@ default Builder withDefaults() { Builder setResponseCodeOnRedirectError(Integer value); - Builder setUserAgent(String value); - Builder setClientSpanErrorMapper(BiFunction value); Builder setSingleConnectionFactory(BiFunction value); From e874cd996a644663d329f0c2780cff56c1b70cbe Mon Sep 17 00:00:00 2001 From: Mateusz Rzeszutek Date: Mon, 30 Oct 2023 15:06:09 +0100 Subject: [PATCH 2/2] fix tests --- ...tpClientAdditionalAttributesExtractor.java | 39 ------------------- .../v2_0/AsyncHttpClientSingletons.java | 1 - .../src/test/groovy/S3TracingTest.groovy | 2 - .../src/test/groovy/SnsTracingTest.groovy | 1 - .../v1_11/AbstractSqsTracingTest.groovy | 2 - .../v2_2/TracingExecutionInterceptor.java | 11 ------ .../v2_2/AbstractAws2ClientCoreTest.groovy | 3 -- .../awssdk/v2_2/AbstractAws2ClientTest.groovy | 3 -- .../v2_2/AbstractAws2SqsTracingTest.groovy | 7 ---- .../apachecamel/aws/AwsSpanAssertions.java | 6 --- .../apiclient/ElasticsearchClientTest.java | 8 ---- .../src/test/groovy/JaxRsClientTest.groovy | 1 - .../JettyHttpClient9TracingInterceptor.java | 14 +------ .../KubernetesClientTest.java | 4 -- .../okhttp/v3_0/AbstractOkHttp3Test.java | 4 -- .../AbstractReactorNettyHttpClientTest.java | 2 + .../v1_0/ReactorNettyBaseUrlOnlyTest.java | 1 - .../v1_0/ReactorNettyClientSslTest.java | 1 - .../v1_0/ReactorNettyConnectionSpanTest.java | 1 - 19 files changed, 3 insertions(+), 108 deletions(-) delete mode 100644 instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientAdditionalAttributesExtractor.java diff --git a/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientAdditionalAttributesExtractor.java b/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientAdditionalAttributesExtractor.java deleted file mode 100644 index 7d7c5f0987e4..000000000000 --- a/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientAdditionalAttributesExtractor.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.javaagent.instrumentation.asynchttpclient.v2_0; - -import io.opentelemetry.api.common.AttributesBuilder; -import io.opentelemetry.context.Context; -import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; -import io.opentelemetry.semconv.SemanticAttributes; -import javax.annotation.Nullable; -import org.asynchttpclient.Response; -import org.asynchttpclient.netty.request.NettyRequest; - -public class AsyncHttpClientAdditionalAttributesExtractor - implements AttributesExtractor { - - @Override - public void onStart( - AttributesBuilder attributes, Context parentContext, RequestContext requestContext) {} - - @Override - public void onEnd( - AttributesBuilder attributes, - Context context, - RequestContext requestContext, - @Nullable Response response, - @Nullable Throwable error) { - - NettyRequest nettyRequest = requestContext.getNettyRequest(); - if (nettyRequest != null) { - String userAgent = nettyRequest.getHttpRequest().headers().get("User-Agent"); - if (userAgent != null) { - attributes.put(SemanticAttributes.USER_AGENT_ORIGINAL, userAgent); - } - } - } -} diff --git a/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientSingletons.java b/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientSingletons.java index 8efc89058487..ed902b20ba90 100644 --- a/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientSingletons.java +++ b/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientSingletons.java @@ -43,7 +43,6 @@ public final class AsyncHttpClientSingletons { .addAttributesExtractor( HttpClientPeerServiceAttributesExtractor.create( httpAttributesGetter, CommonConfig.get().getPeerServiceResolver())) - .addAttributesExtractor(new AsyncHttpClientAdditionalAttributesExtractor()) .addOperationMetrics(HttpClientMetrics.get()); if (CommonConfig.get().shouldEmitExperimentalHttpClientMetrics()) { builder.addOperationMetrics(HttpClientExperimentalMetrics.get()); diff --git a/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test/groovy/S3TracingTest.groovy b/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test/groovy/S3TracingTest.groovy index eca88add714d..1a66b2f6c494 100644 --- a/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test/groovy/S3TracingTest.groovy +++ b/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test/groovy/S3TracingTest.groovy @@ -205,7 +205,6 @@ class S3TracingTest extends AgentInstrumentationSpecification { "http.method" "POST" "http.status_code" 200 "http.url" String - "$SemanticAttributes.USER_AGENT_ORIGINAL" String "net.peer.name" String "$SemanticAttributes.NET_PROTOCOL_NAME" "http" "$SemanticAttributes.NET_PROTOCOL_VERSION" "1.1" @@ -572,7 +571,6 @@ class S3TracingTest extends AgentInstrumentationSpecification { "http.method" "POST" "http.status_code" 200 "http.url" String - "$SemanticAttributes.USER_AGENT_ORIGINAL" String "net.peer.name" String "$SemanticAttributes.NET_PROTOCOL_NAME" "http" "$SemanticAttributes.NET_PROTOCOL_VERSION" "1.1" diff --git a/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test/groovy/SnsTracingTest.groovy b/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test/groovy/SnsTracingTest.groovy index 6aa9557cb2ac..e702c04fec4b 100644 --- a/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test/groovy/SnsTracingTest.groovy +++ b/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test/groovy/SnsTracingTest.groovy @@ -189,7 +189,6 @@ class SnsTracingTest extends AgentInstrumentationSpecification { "http.method" "POST" "http.status_code" 200 "http.url" String - "$SemanticAttributes.USER_AGENT_ORIGINAL" String "net.peer.name" String "$SemanticAttributes.NET_PROTOCOL_NAME" "http" "$SemanticAttributes.NET_PROTOCOL_VERSION" "1.1" diff --git a/instrumentation/aws-sdk/aws-sdk-1.11/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v1_11/AbstractSqsTracingTest.groovy b/instrumentation/aws-sdk/aws-sdk-1.11/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v1_11/AbstractSqsTracingTest.groovy index 67c8543e721f..c2c6b8826774 100644 --- a/instrumentation/aws-sdk/aws-sdk-1.11/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v1_11/AbstractSqsTracingTest.groovy +++ b/instrumentation/aws-sdk/aws-sdk-1.11/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v1_11/AbstractSqsTracingTest.groovy @@ -123,7 +123,6 @@ abstract class AbstractSqsTracingTest extends InstrumentationSpecification { "http.method" "POST" "http.status_code" 200 "http.url" "http://localhost:$sqsPort" - "$SemanticAttributes.USER_AGENT_ORIGINAL" String "net.peer.name" "localhost" "net.peer.port" sqsPort "$SemanticAttributes.MESSAGING_SYSTEM" "AmazonSQS" @@ -213,7 +212,6 @@ abstract class AbstractSqsTracingTest extends InstrumentationSpecification { "http.method" "POST" "http.status_code" 200 "http.url" "http://localhost:$sqsPort" - "$SemanticAttributes.USER_AGENT_ORIGINAL" String "net.peer.name" "localhost" "net.peer.port" sqsPort "$SemanticAttributes.MESSAGING_SYSTEM" "AmazonSQS" diff --git a/instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/TracingExecutionInterceptor.java b/instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/TracingExecutionInterceptor.java index f4c060658ff2..1eb7bd5b4a06 100644 --- a/instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/TracingExecutionInterceptor.java +++ b/instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/TracingExecutionInterceptor.java @@ -23,7 +23,6 @@ import java.io.InputStreamReader; import java.nio.charset.Charset; import java.time.Instant; -import java.util.List; import java.util.Optional; import java.util.stream.Collectors; import javax.annotation.Nullable; @@ -322,7 +321,6 @@ public void afterExecution( executionAttributes.putAttribute(SDK_HTTP_REQUEST_ATTRIBUTE, context.httpRequest()); Span span = Span.fromContext(otelContext); - onUserAgentHeaderAvailable(span, executionAttributes); onSdkResponse(span, context.response(), executionAttributes); SdkHttpResponse httpResponse = context.httpResponse(); @@ -336,15 +334,6 @@ public void afterExecution( clearAttributes(executionAttributes); } - // Certain headers in the request like User-Agent are only available after execution. - private static void onUserAgentHeaderAvailable(Span span, ExecutionAttributes request) { - List userAgent = - AwsSdkInstrumenterFactory.httpAttributesGetter.getHttpRequestHeader(request, "User-Agent"); - if (!userAgent.isEmpty()) { - span.setAttribute(SemanticAttributes.USER_AGENT_ORIGINAL, userAgent.get(0)); - } - } - private void onSdkResponse( Span span, SdkResponse response, ExecutionAttributes executionAttributes) { if (captureExperimentalSpanAttributes) { diff --git a/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2ClientCoreTest.groovy b/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2ClientCoreTest.groovy index 593241c044e0..cf216cb0f591 100644 --- a/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2ClientCoreTest.groovy +++ b/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2ClientCoreTest.groovy @@ -138,7 +138,6 @@ abstract class AbstractAws2ClientCoreTest extends InstrumentationSpecification { "$SemanticAttributes.HTTP_URL" { it.startsWith("${server.httpUri()}${path}") } "$SemanticAttributes.HTTP_METHOD" "$method" "$SemanticAttributes.HTTP_STATUS_CODE" 200 - "$SemanticAttributes.USER_AGENT_ORIGINAL" { it.startsWith("aws-sdk-java/") } "$SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH" { it == null || it instanceof Long } "$SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH" { it == null || it instanceof Long } "$SemanticAttributes.RPC_SYSTEM" "aws-api" @@ -174,7 +173,6 @@ abstract class AbstractAws2ClientCoreTest extends InstrumentationSpecification { "$SemanticAttributes.HTTP_URL" { it.startsWith("${server.httpUri()}${path}") } "$SemanticAttributes.HTTP_METHOD" "$method" "$SemanticAttributes.HTTP_STATUS_CODE" 200 - "$SemanticAttributes.USER_AGENT_ORIGINAL" { it.startsWith("aws-sdk-java/") } "$SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH" { it == null || it instanceof Long } "$SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH" { it == null || it instanceof Long } "$SemanticAttributes.RPC_SYSTEM" "aws-api" @@ -209,7 +207,6 @@ abstract class AbstractAws2ClientCoreTest extends InstrumentationSpecification { "$SemanticAttributes.HTTP_URL" { it.startsWith("${server.httpUri()}${path}") } "$SemanticAttributes.HTTP_METHOD" "$method" "$SemanticAttributes.HTTP_STATUS_CODE" 200 - "$SemanticAttributes.USER_AGENT_ORIGINAL" { it.startsWith("aws-sdk-java/") } "$SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH" { it == null || it instanceof Long } "$SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH" { it == null || it instanceof Long } "$SemanticAttributes.RPC_SYSTEM" "aws-api" diff --git a/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2ClientTest.groovy b/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2ClientTest.groovy index 1d8218b6f45e..f852619a4f44 100644 --- a/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2ClientTest.groovy +++ b/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2ClientTest.groovy @@ -101,7 +101,6 @@ abstract class AbstractAws2ClientTest extends AbstractAws2ClientCoreTest { "$SemanticAttributes.NET_PEER_PORT" server.httpPort() "$SemanticAttributes.HTTP_METHOD" "$method" "$SemanticAttributes.HTTP_STATUS_CODE" 200 - "$SemanticAttributes.USER_AGENT_ORIGINAL" { it.startsWith("aws-sdk-java/") } "$SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH" { it == null || it instanceof Long } "$SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH" { it == null || it instanceof Long } "$SemanticAttributes.RPC_SYSTEM" "aws-api" @@ -204,7 +203,6 @@ abstract class AbstractAws2ClientTest extends AbstractAws2ClientCoreTest { "$SemanticAttributes.NET_PEER_PORT" server.httpPort() "$SemanticAttributes.HTTP_METHOD" "$method" "$SemanticAttributes.HTTP_STATUS_CODE" 200 - "$SemanticAttributes.USER_AGENT_ORIGINAL" { it.startsWith("aws-sdk-java/") } "$SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH" { it == null || it instanceof Long } "$SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH" { it == null || it instanceof Long } "$SemanticAttributes.RPC_SYSTEM" "aws-api" @@ -333,7 +331,6 @@ abstract class AbstractAws2ClientTest extends AbstractAws2ClientCoreTest { "$SemanticAttributes.RPC_SYSTEM" "aws-api" "$SemanticAttributes.RPC_SERVICE" "S3" "$SemanticAttributes.RPC_METHOD" "GetObject" - "$SemanticAttributes.USER_AGENT_ORIGINAL" String "aws.agent" "java-aws-sdk" "aws.bucket.name" "somebucket" } diff --git a/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2SqsTracingTest.groovy b/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2SqsTracingTest.groovy index 705ce85fd693..f6f957b7ecc8 100644 --- a/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2SqsTracingTest.groovy +++ b/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2SqsTracingTest.groovy @@ -128,7 +128,6 @@ abstract class AbstractAws2SqsTracingTest extends InstrumentationSpecification { "http.method" "POST" "http.status_code" 200 "http.url" { it.startsWith("http://localhost:$sqsPort") } - "$SemanticAttributes.USER_AGENT_ORIGINAL" String "net.peer.name" "localhost" "net.peer.port" sqsPort "$SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH" { it == null || it instanceof Long } @@ -151,7 +150,6 @@ abstract class AbstractAws2SqsTracingTest extends InstrumentationSpecification { "http.method" "POST" "http.status_code" 200 "http.url" { it.startsWith("http://localhost:$sqsPort") } - "$SemanticAttributes.USER_AGENT_ORIGINAL" String "net.peer.name" "localhost" "net.peer.port" sqsPort "$SemanticAttributes.MESSAGING_SYSTEM" "AmazonSQS" @@ -174,7 +172,6 @@ abstract class AbstractAws2SqsTracingTest extends InstrumentationSpecification { "http.method" "POST" "http.status_code" 200 "http.url" { it.startsWith("http://localhost:$sqsPort") } - "$SemanticAttributes.USER_AGENT_ORIGINAL" String "net.peer.name" "localhost" "net.peer.port" sqsPort "$SemanticAttributes.MESSAGING_SYSTEM" "AmazonSQS" @@ -210,7 +207,6 @@ abstract class AbstractAws2SqsTracingTest extends InstrumentationSpecification { "http.method" "POST" "http.status_code" 200 "http.url" { it.startsWith("http://localhost:$sqsPort") } - "$SemanticAttributes.USER_AGENT_ORIGINAL" String "net.peer.name" "localhost" "net.peer.port" sqsPort "$SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH" { it == null || it instanceof Long } @@ -321,7 +317,6 @@ abstract class AbstractAws2SqsTracingTest extends InstrumentationSpecification { "http.method" "POST" "http.status_code" 200 "http.url" { it.startsWith("http://localhost:$sqsPort") } - "$SemanticAttributes.USER_AGENT_ORIGINAL" String "net.peer.name" "localhost" "net.peer.port" sqsPort "$SemanticAttributes.MESSAGING_SYSTEM" "AmazonSQS" @@ -345,7 +340,6 @@ abstract class AbstractAws2SqsTracingTest extends InstrumentationSpecification { "http.method" "POST" "http.status_code" 200 "http.url" { it.startsWith("http://localhost:$sqsPort") } - "$SemanticAttributes.USER_AGENT_ORIGINAL" String "net.peer.name" "localhost" "net.peer.port" sqsPort "$SemanticAttributes.MESSAGING_SYSTEM" "AmazonSQS" @@ -376,7 +370,6 @@ abstract class AbstractAws2SqsTracingTest extends InstrumentationSpecification { "http.status_code" 200 "http.url" { it.startsWith("http://localhost:$sqsPort") } "net.peer.name" "localhost" - "$SemanticAttributes.USER_AGENT_ORIGINAL" String "net.peer.port" sqsPort "$SemanticAttributes.MESSAGING_SYSTEM" "AmazonSQS" "$SemanticAttributes.MESSAGING_DESTINATION_NAME" "testSdkSqs" diff --git a/instrumentation/camel-2.20/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachecamel/aws/AwsSpanAssertions.java b/instrumentation/camel-2.20/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachecamel/aws/AwsSpanAssertions.java index 0b99ed6bdb80..91a446b2e8b1 100644 --- a/instrumentation/camel-2.20/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachecamel/aws/AwsSpanAssertions.java +++ b/instrumentation/camel-2.20/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachecamel/aws/AwsSpanAssertions.java @@ -79,12 +79,6 @@ static SpanDataAssert sqs( val -> val.satisfiesAnyOf( v -> assertThat(v).isNull(), v -> assertThat(v).isInstanceOf(Long.class))), - satisfies( - SemanticAttributes.USER_AGENT_ORIGINAL, - val -> - val.satisfiesAnyOf( - v -> assertThat(v).isNull(), - v -> assertThat(v).isInstanceOf(String.class))), satisfies(SemanticAttributes.HTTP_URL, val -> val.isInstanceOf(String.class)), satisfies( stringKey("net.peer.name"), diff --git a/instrumentation/elasticsearch/elasticsearch-api-client-7.16/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/apiclient/ElasticsearchClientTest.java b/instrumentation/elasticsearch/elasticsearch-api-client-7.16/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/apiclient/ElasticsearchClientTest.java index 0770dcf4c308..07fc5e7ad6a9 100644 --- a/instrumentation/elasticsearch/elasticsearch-api-client-7.16/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/apiclient/ElasticsearchClientTest.java +++ b/instrumentation/elasticsearch/elasticsearch-api-client-7.16/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/apiclient/ElasticsearchClientTest.java @@ -14,7 +14,6 @@ import co.elastic.clients.elasticsearch.core.InfoResponse; import co.elastic.clients.json.jackson.JacksonJsonpMapper; import co.elastic.clients.transport.ElasticsearchTransport; -import co.elastic.clients.transport.Version; import co.elastic.clients.transport.rest_client.RestClientTransport; import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.trace.SpanKind; @@ -76,10 +75,6 @@ static void cleanUp() { elasticsearch.stop(); } - private static String userAgent() { - return "elastic-java/" + Version.VERSION + " (Java/" + System.getProperty("java.version") + ")"; - } - @Test public void elasticsearchStatus() throws IOException { InfoResponse response = client.info(); @@ -111,7 +106,6 @@ public void elasticsearchStatus() throws IOException { equalTo(SemanticAttributes.NET_PROTOCOL_VERSION, "1.1"), equalTo(SemanticAttributes.HTTP_URL, httpHost.toURI() + "/"), equalTo(SemanticAttributes.HTTP_STATUS_CODE, 200L), - equalTo(SemanticAttributes.USER_AGENT_ORIGINAL, userAgent()), satisfies( SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH, AbstractLongAssert::isPositive)))); @@ -162,7 +156,6 @@ public void elasticsearchIndex() throws IOException { SemanticAttributes.HTTP_URL, httpHost.toURI() + "/test-index/_doc/test-id?timeout=10s"), equalTo(SemanticAttributes.HTTP_STATUS_CODE, 201L), - equalTo(SemanticAttributes.USER_AGENT_ORIGINAL, userAgent()), satisfies( SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH, AbstractLongAssert::isPositive)))); @@ -218,7 +211,6 @@ public void elasticsearchStatusAsync() throws Exception { equalTo(SemanticAttributes.NET_PROTOCOL_VERSION, "1.1"), equalTo(SemanticAttributes.HTTP_URL, httpHost.toURI() + "/"), equalTo(SemanticAttributes.HTTP_STATUS_CODE, 200L), - equalTo(SemanticAttributes.USER_AGENT_ORIGINAL, userAgent()), satisfies( SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH, AbstractLongAssert::isPositive)), diff --git a/instrumentation/jaxrs-client/jaxrs-client-2.0-testing/src/test/groovy/JaxRsClientTest.groovy b/instrumentation/jaxrs-client/jaxrs-client-2.0-testing/src/test/groovy/JaxRsClientTest.groovy index 43cdf4d74456..1ab19154bbf8 100644 --- a/instrumentation/jaxrs-client/jaxrs-client-2.0-testing/src/test/groovy/JaxRsClientTest.groovy +++ b/instrumentation/jaxrs-client/jaxrs-client-2.0-testing/src/test/groovy/JaxRsClientTest.groovy @@ -115,7 +115,6 @@ abstract class JaxRsClientTest extends HttpClientTest implem "$SemanticAttributes.HTTP_URL" "${uri}" "$SemanticAttributes.HTTP_METHOD" method "$SemanticAttributes.HTTP_STATUS_CODE" statusCode - "$SemanticAttributes.USER_AGENT_ORIGINAL" { it == null || it instanceof String } "$SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH" { it == null || it instanceof Long } } } diff --git a/instrumentation/jetty-httpclient/jetty-httpclient-9.2/library/src/main/java/io/opentelemetry/instrumentation/jetty/httpclient/v9_2/internal/JettyHttpClient9TracingInterceptor.java b/instrumentation/jetty-httpclient/jetty-httpclient-9.2/library/src/main/java/io/opentelemetry/instrumentation/jetty/httpclient/v9_2/internal/JettyHttpClient9TracingInterceptor.java index f52f9b851994..818d67ce339d 100644 --- a/instrumentation/jetty-httpclient/jetty-httpclient-9.2/library/src/main/java/io/opentelemetry/instrumentation/jetty/httpclient/v9_2/internal/JettyHttpClient9TracingInterceptor.java +++ b/instrumentation/jetty-httpclient/jetty-httpclient-9.2/library/src/main/java/io/opentelemetry/instrumentation/jetty/httpclient/v9_2/internal/JettyHttpClient9TracingInterceptor.java @@ -5,11 +5,9 @@ package io.opentelemetry.instrumentation.jetty.httpclient.v9_2.internal; -import io.opentelemetry.api.trace.Span; import io.opentelemetry.context.Context; import io.opentelemetry.context.Scope; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; -import io.opentelemetry.semconv.SemanticAttributes; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Proxy; import java.util.ArrayList; @@ -20,8 +18,6 @@ import org.eclipse.jetty.client.api.Request; import org.eclipse.jetty.client.api.Response; import org.eclipse.jetty.client.api.Result; -import org.eclipse.jetty.http.HttpField; -import org.eclipse.jetty.http.HttpHeader; /** * JettyHttpClient9TracingInterceptor does three jobs stimulated from the Jetty Request object from @@ -137,15 +133,7 @@ private void startSpan(Request request) { } @Override - public void onBegin(Request request) { - if (this.context != null) { - Span span = Span.fromContext(this.context); - HttpField agentField = request.getHeaders().getField(HttpHeader.USER_AGENT); - if (agentField != null) { - span.setAttribute(SemanticAttributes.USER_AGENT_ORIGINAL, agentField.getValue()); - } - } - } + public void onBegin(Request request) {} @Override public void onComplete(Result result) { diff --git a/instrumentation/kubernetes-client-7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/kubernetesclient/KubernetesClientTest.java b/instrumentation/kubernetes-client-7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/kubernetesclient/KubernetesClientTest.java index 37e3e22d612b..386177ee3188 100644 --- a/instrumentation/kubernetes-client-7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/kubernetesclient/KubernetesClientTest.java +++ b/instrumentation/kubernetes-client-7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/kubernetesclient/KubernetesClientTest.java @@ -84,7 +84,6 @@ void synchronousCall() throws ApiException { mockWebServer.httpUri() + "/api/v1/namespaces/namespace/pods/name/proxy?path=path"), equalTo(SemanticAttributes.HTTP_METHOD, "GET"), - equalTo(SemanticAttributes.USER_AGENT_ORIGINAL, TEST_USER_AGENT), equalTo(SemanticAttributes.HTTP_STATUS_CODE, 200), equalTo(SemanticAttributes.NET_PEER_NAME, "127.0.0.1"), equalTo(SemanticAttributes.NET_PEER_PORT, mockWebServer.httpPort()), @@ -135,7 +134,6 @@ void handleErrorsInSyncCall() { mockWebServer.httpUri() + "/api/v1/namespaces/namespace/pods/name/proxy?path=path"), equalTo(SemanticAttributes.HTTP_METHOD, "GET"), - equalTo(SemanticAttributes.USER_AGENT_ORIGINAL, TEST_USER_AGENT), equalTo(SemanticAttributes.HTTP_STATUS_CODE, 451), equalTo(SemanticAttributes.NET_PEER_NAME, "127.0.0.1"), equalTo(SemanticAttributes.NET_PEER_PORT, mockWebServer.httpPort()), @@ -192,7 +190,6 @@ public void onSuccess( mockWebServer.httpUri() + "/api/v1/namespaces/namespace/pods/name/proxy?path=path"), equalTo(SemanticAttributes.HTTP_METHOD, "GET"), - equalTo(SemanticAttributes.USER_AGENT_ORIGINAL, TEST_USER_AGENT), equalTo(SemanticAttributes.HTTP_STATUS_CODE, 200), equalTo(SemanticAttributes.NET_PEER_NAME, "127.0.0.1"), equalTo(SemanticAttributes.NET_PEER_PORT, mockWebServer.httpPort()), @@ -257,7 +254,6 @@ public void onFailure( mockWebServer.httpUri() + "/api/v1/namespaces/namespace/pods/name/proxy?path=path"), equalTo(SemanticAttributes.HTTP_METHOD, "GET"), - equalTo(SemanticAttributes.USER_AGENT_ORIGINAL, TEST_USER_AGENT), equalTo(SemanticAttributes.HTTP_STATUS_CODE, 451), equalTo(SemanticAttributes.NET_PEER_NAME, "127.0.0.1"), equalTo(SemanticAttributes.NET_PEER_PORT, mockWebServer.httpPort()), diff --git a/instrumentation/okhttp/okhttp-3.0/testing/src/main/java/io/opentelemetry/instrumentation/okhttp/v3_0/AbstractOkHttp3Test.java b/instrumentation/okhttp/okhttp-3.0/testing/src/main/java/io/opentelemetry/instrumentation/okhttp/v3_0/AbstractOkHttp3Test.java index 0e5056202028..4b2a095ae7bb 100644 --- a/instrumentation/okhttp/okhttp-3.0/testing/src/main/java/io/opentelemetry/instrumentation/okhttp/v3_0/AbstractOkHttp3Test.java +++ b/instrumentation/okhttp/okhttp-3.0/testing/src/main/java/io/opentelemetry/instrumentation/okhttp/v3_0/AbstractOkHttp3Test.java @@ -122,10 +122,6 @@ protected void configure(HttpClientTestOptions.Builder optionsBuilder) { uri -> { Set> attributes = new HashSet<>(HttpClientTestOptions.DEFAULT_HTTP_ATTRIBUTES); - // the tests are capturing the user-agent, but since it's not possible to override it in - // the builder, and since it contains the okhttp library version, let's just skip - // verification on this attribute - attributes.remove(SemanticAttributes.USER_AGENT_ORIGINAL); if (SemconvStability.emitOldHttpSemconv()) { // protocol is extracted from the response, and those URLs cause exceptions (= null diff --git a/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/AbstractReactorNettyHttpClientTest.java b/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/AbstractReactorNettyHttpClientTest.java index 6b5c2b65b6b2..a0503b9c976f 100644 --- a/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/AbstractReactorNettyHttpClientTest.java +++ b/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/AbstractReactorNettyHttpClientTest.java @@ -44,6 +44,8 @@ abstract class AbstractReactorNettyHttpClientTest extends AbstractHttpClientTest> { + static final String USER_AGENT = "ReactorNetty"; + @RegisterExtension static final InstrumentationExtension testing = HttpClientInstrumentationExtension.forAgent(); diff --git a/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyBaseUrlOnlyTest.java b/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyBaseUrlOnlyTest.java index 357ef3d10c23..14d9d565eced 100644 --- a/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyBaseUrlOnlyTest.java +++ b/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyBaseUrlOnlyTest.java @@ -111,7 +111,6 @@ void testSuccessfulRequest() { .hasAttributesSatisfyingExactly( equalTo(SemanticAttributes.HTTP_METHOD, "GET"), equalTo(SemanticAttributes.HTTP_URL, uri + "/"), - equalTo(SemanticAttributes.USER_AGENT_ORIGINAL, USER_AGENT), equalTo(SemanticAttributes.HTTP_STATUS_CODE, 200), equalTo(SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH, 0), satisfies( diff --git a/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyClientSslTest.java b/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyClientSslTest.java index 1e7e805e19b4..16aeb4a4617f 100644 --- a/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyClientSslTest.java +++ b/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyClientSslTest.java @@ -188,7 +188,6 @@ void shouldSuccessfullyEstablishSslHandshake() throws SSLException { .hasAttributesSatisfyingExactly( equalTo(SemanticAttributes.HTTP_METHOD, "GET"), equalTo(SemanticAttributes.HTTP_URL, uri), - equalTo(SemanticAttributes.USER_AGENT_ORIGINAL, USER_AGENT), equalTo(SemanticAttributes.NET_PROTOCOL_NAME, "http"), equalTo(SemanticAttributes.NET_PROTOCOL_VERSION, "1.1"), equalTo(SemanticAttributes.HTTP_STATUS_CODE, 200), diff --git a/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyConnectionSpanTest.java b/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyConnectionSpanTest.java index 7fbf042310d7..96aecc5b2847 100644 --- a/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyConnectionSpanTest.java +++ b/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyConnectionSpanTest.java @@ -102,7 +102,6 @@ void testSuccessfulRequest() { .hasAttributesSatisfyingExactly( equalTo(SemanticAttributes.HTTP_METHOD, "GET"), equalTo(SemanticAttributes.HTTP_URL, uri), - equalTo(SemanticAttributes.USER_AGENT_ORIGINAL, USER_AGENT), equalTo(SemanticAttributes.NET_PROTOCOL_NAME, "http"), equalTo(SemanticAttributes.NET_PROTOCOL_VERSION, "1.1"), equalTo(SemanticAttributes.HTTP_STATUS_CODE, 200),