From 06ef21a51dd7f6910a48423d3665b7eadb49cc66 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Tue, 18 Jun 2024 16:04:03 -0700 Subject: [PATCH] Renames --- ...> AbstractHttpClientTelemetryBuilder.java} | 4 +- .../client/AkkaHttpClientSingletons.java | 4 +- .../ApacheHttpAsyncClientSingletons.java | 4 +- .../v2_0/ApacheHttpClientSingletons.java | 4 +- .../v4_0/ApacheHttpClientSingletons.java | 4 +- .../ApacheHttpClientTelemetryBuilder.java | 4 +- .../v5_0/ApacheHttpClientSingletons.java | 4 +- .../v1_9/AsyncHttpClientSingletons.java | 4 +- .../v2_0/AsyncHttpClientSingletons.java | 4 +- .../GoogleHttpClientSingletons.java | 4 +- .../HttpUrlConnectionSingletons.java | 4 +- .../httpclient/JavaHttpClientSingletons.java | 3 +- .../JavaHttpClientTelemetryBuilder.java | 5 ++- .../v9_2/JettyHttpClientSingletons.java | 4 +- .../v9_2/JettyClientTelemetryBuilder.java | 4 +- .../joddhttp/v4_2/JoddHttpSingletons.java | 4 +- .../v3_8/client/NettyClientSingletons.java | 4 +- .../okhttp/v2_2/OkHttp2Singletons.java | 4 +- .../client/PekkoHttpClientSingletons.java | 4 +- .../PlayWsClientInstrumenterFactory.java | 4 +- .../v1_0/ReactorNettySingletons.java | 4 +- .../web/v3_1/SpringWebTelemetryBuilder.java | 5 ++- .../VertxClientInstrumenterFactory.java | 4 +- ...vaagentHttpClientInstrumenterBuilder.java} | 42 +++++++------------ 24 files changed, 63 insertions(+), 72 deletions(-) rename instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/{HttpClientConfigBuilder.java => AbstractHttpClientTelemetryBuilder.java} (98%) rename javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/{HttpClientInstrumenterFactory.java => JavaagentHttpClientInstrumenterBuilder.java} (60%) diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/HttpClientConfigBuilder.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/AbstractHttpClientTelemetryBuilder.java similarity index 98% rename from instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/HttpClientConfigBuilder.java rename to instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/AbstractHttpClientTelemetryBuilder.java index f688f7c52b18..636215cd5c74 100644 --- a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/HttpClientConfigBuilder.java +++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/AbstractHttpClientTelemetryBuilder.java @@ -27,7 +27,7 @@ import java.util.Set; import java.util.function.Function; -public abstract class HttpClientConfigBuilder { +public abstract class AbstractHttpClientTelemetryBuilder { private final String instrumentationName; protected final OpenTelemetry openTelemetry; @@ -42,7 +42,7 @@ public abstract class HttpClientConfigBuilder { spanNameExtractorTransformer = Function.identity(); private boolean emitExperimentalHttpClientMetrics = false; - protected HttpClientConfigBuilder( + public AbstractHttpClientTelemetryBuilder( String instrumentationName, OpenTelemetry openTelemetry, HttpClientAttributesGetter attributesGetter) { diff --git a/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/client/AkkaHttpClientSingletons.java b/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/client/AkkaHttpClientSingletons.java index 23e6ff9aec4d..4d1097ef128e 100644 --- a/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/client/AkkaHttpClientSingletons.java +++ b/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/client/AkkaHttpClientSingletons.java @@ -10,7 +10,7 @@ import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.SpanKindExtractor; -import io.opentelemetry.javaagent.bootstrap.internal.HttpClientInstrumenterFactory; +import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenterBuilder; import io.opentelemetry.javaagent.instrumentation.akkahttp.AkkaHttpUtil; public class AkkaHttpClientSingletons { @@ -21,7 +21,7 @@ public class AkkaHttpClientSingletons { static { SETTER = new HttpHeaderSetter(GlobalOpenTelemetry.getPropagators()); INSTRUMENTER = - HttpClientInstrumenterFactory.builder( + JavaagentHttpClientInstrumenterBuilder.create( AkkaHttpUtil.instrumentationName(), new AkkaHttpClientAttributesGetter()) .buildInstrumenter(SpanKindExtractor.alwaysClient()); } diff --git a/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientSingletons.java b/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientSingletons.java index 64dc1de9dc11..db4188c60e39 100644 --- a/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientSingletons.java +++ b/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientSingletons.java @@ -6,7 +6,7 @@ package io.opentelemetry.javaagent.instrumentation.apachehttpasyncclient; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; -import io.opentelemetry.javaagent.bootstrap.internal.HttpClientInstrumenterFactory; +import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenterBuilder; import org.apache.http.HttpResponse; public final class ApacheHttpAsyncClientSingletons { @@ -16,7 +16,7 @@ public final class ApacheHttpAsyncClientSingletons { static { INSTRUMENTER = - HttpClientInstrumenterFactory.builder( + JavaagentHttpClientInstrumenterBuilder.create( INSTRUMENTATION_NAME, new ApacheHttpAsyncClientHttpAttributesGetter()) .buildClientInstrumenter(HttpHeaderSetter.INSTANCE); } diff --git a/instrumentation/apache-httpclient/apache-httpclient-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v2_0/ApacheHttpClientSingletons.java b/instrumentation/apache-httpclient/apache-httpclient-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v2_0/ApacheHttpClientSingletons.java index 1b73b14180cc..ad200ac44aad 100644 --- a/instrumentation/apache-httpclient/apache-httpclient-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v2_0/ApacheHttpClientSingletons.java +++ b/instrumentation/apache-httpclient/apache-httpclient-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v2_0/ApacheHttpClientSingletons.java @@ -6,7 +6,7 @@ package io.opentelemetry.javaagent.instrumentation.apachehttpclient.v2_0; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; -import io.opentelemetry.javaagent.bootstrap.internal.HttpClientInstrumenterFactory; +import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenterBuilder; import org.apache.commons.httpclient.HttpMethod; public final class ApacheHttpClientSingletons { @@ -16,7 +16,7 @@ public final class ApacheHttpClientSingletons { static { INSTRUMENTER = - HttpClientInstrumenterFactory.builder( + JavaagentHttpClientInstrumenterBuilder.create( INSTRUMENTATION_NAME, new ApacheHttpClientHttpAttributesGetter()) .buildClientInstrumenter(HttpHeaderSetter.INSTANCE); } diff --git a/instrumentation/apache-httpclient/apache-httpclient-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v4_0/ApacheHttpClientSingletons.java b/instrumentation/apache-httpclient/apache-httpclient-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v4_0/ApacheHttpClientSingletons.java index a55a73d0a242..6f4fb7af443a 100644 --- a/instrumentation/apache-httpclient/apache-httpclient-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v4_0/ApacheHttpClientSingletons.java +++ b/instrumentation/apache-httpclient/apache-httpclient-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v4_0/ApacheHttpClientSingletons.java @@ -6,7 +6,7 @@ package io.opentelemetry.javaagent.instrumentation.apachehttpclient.v4_0; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; -import io.opentelemetry.javaagent.bootstrap.internal.HttpClientInstrumenterFactory; +import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenterBuilder; import org.apache.http.HttpResponse; public final class ApacheHttpClientSingletons { @@ -16,7 +16,7 @@ public final class ApacheHttpClientSingletons { static { INSTRUMENTER = - HttpClientInstrumenterFactory.builder( + JavaagentHttpClientInstrumenterBuilder.create( INSTRUMENTATION_NAME, new ApacheHttpClientHttpAttributesGetter()) .buildClientInstrumenter(HttpHeaderSetter.INSTANCE); } diff --git a/instrumentation/apache-httpclient/apache-httpclient-4.3/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/ApacheHttpClientTelemetryBuilder.java b/instrumentation/apache-httpclient/apache-httpclient-4.3/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/ApacheHttpClientTelemetryBuilder.java index b2664504efdc..a2fa218d4621 100644 --- a/instrumentation/apache-httpclient/apache-httpclient-4.3/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/ApacheHttpClientTelemetryBuilder.java +++ b/instrumentation/apache-httpclient/apache-httpclient-4.3/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/ApacheHttpClientTelemetryBuilder.java @@ -6,13 +6,13 @@ package io.opentelemetry.instrumentation.apachehttpclient.v4_3; import io.opentelemetry.api.OpenTelemetry; -import io.opentelemetry.instrumentation.api.incubator.builder.HttpClientConfigBuilder; +import io.opentelemetry.instrumentation.api.incubator.builder.AbstractHttpClientTelemetryBuilder; import io.opentelemetry.instrumentation.api.instrumenter.SpanKindExtractor; import org.apache.http.HttpResponse; /** A builder for {@link ApacheHttpClientTelemetry}. */ public final class ApacheHttpClientTelemetryBuilder - extends HttpClientConfigBuilder< + extends AbstractHttpClientTelemetryBuilder< ApacheHttpClientTelemetryBuilder, ApacheHttpClientRequest, HttpResponse> { private static final String INSTRUMENTATION_NAME = "io.opentelemetry.apache-httpclient-4.3"; diff --git a/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpClientSingletons.java b/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpClientSingletons.java index f9b9f1288d0c..d962caa2f1c4 100644 --- a/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpClientSingletons.java +++ b/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpClientSingletons.java @@ -6,7 +6,7 @@ package io.opentelemetry.javaagent.instrumentation.apachehttpclient.v5_0; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; -import io.opentelemetry.javaagent.bootstrap.internal.HttpClientInstrumenterFactory; +import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenterBuilder; import org.apache.hc.core5.http.HttpRequest; import org.apache.hc.core5.http.HttpResponse; @@ -17,7 +17,7 @@ public final class ApacheHttpClientSingletons { static { INSTRUMENTER = - HttpClientInstrumenterFactory.builder( + JavaagentHttpClientInstrumenterBuilder.create( INSTRUMENTATION_NAME, new ApacheHttpClientHttpAttributesGetter()) .buildClientInstrumenter(HttpHeaderSetter.INSTANCE); } diff --git a/instrumentation/async-http-client/async-http-client-1.9/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v1_9/AsyncHttpClientSingletons.java b/instrumentation/async-http-client/async-http-client-1.9/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v1_9/AsyncHttpClientSingletons.java index 7a0e3423764a..53b098061849 100644 --- a/instrumentation/async-http-client/async-http-client-1.9/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v1_9/AsyncHttpClientSingletons.java +++ b/instrumentation/async-http-client/async-http-client-1.9/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v1_9/AsyncHttpClientSingletons.java @@ -8,7 +8,7 @@ import com.ning.http.client.Request; import com.ning.http.client.Response; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; -import io.opentelemetry.javaagent.bootstrap.internal.HttpClientInstrumenterFactory; +import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenterBuilder; public final class AsyncHttpClientSingletons { private static final String INSTRUMENTATION_NAME = "io.opentelemetry.async-http-client-1.9"; @@ -17,7 +17,7 @@ public final class AsyncHttpClientSingletons { static { INSTRUMENTER = - HttpClientInstrumenterFactory.builder( + JavaagentHttpClientInstrumenterBuilder.create( INSTRUMENTATION_NAME, new AsyncHttpClientHttpAttributesGetter()) .buildClientInstrumenter(HttpHeaderSetter.INSTANCE); } 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 709566249100..fa21c8959d5b 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 @@ -6,7 +6,7 @@ package io.opentelemetry.javaagent.instrumentation.asynchttpclient.v2_0; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; -import io.opentelemetry.javaagent.bootstrap.internal.HttpClientInstrumenterFactory; +import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenterBuilder; import org.asynchttpclient.Response; public final class AsyncHttpClientSingletons { @@ -16,7 +16,7 @@ public final class AsyncHttpClientSingletons { static { INSTRUMENTER = - HttpClientInstrumenterFactory.builder( + JavaagentHttpClientInstrumenterBuilder.create( INSTRUMENTATION_NAME, new AsyncHttpClientHttpAttributesGetter()) .buildClientInstrumenter(HttpHeaderSetter.INSTANCE); } diff --git a/instrumentation/google-http-client-1.19/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/googlehttpclient/GoogleHttpClientSingletons.java b/instrumentation/google-http-client-1.19/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/googlehttpclient/GoogleHttpClientSingletons.java index 13f34c58aa9d..8e2b375a2538 100644 --- a/instrumentation/google-http-client-1.19/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/googlehttpclient/GoogleHttpClientSingletons.java +++ b/instrumentation/google-http-client-1.19/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/googlehttpclient/GoogleHttpClientSingletons.java @@ -8,7 +8,7 @@ import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpResponse; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; -import io.opentelemetry.javaagent.bootstrap.internal.HttpClientInstrumenterFactory; +import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenterBuilder; public class GoogleHttpClientSingletons { private static final String INSTRUMENTATION_NAME = "io.opentelemetry.google-http-client-1.19"; @@ -17,7 +17,7 @@ public class GoogleHttpClientSingletons { static { INSTRUMENTER = - HttpClientInstrumenterFactory.builder( + JavaagentHttpClientInstrumenterBuilder.create( INSTRUMENTATION_NAME, new GoogleHttpClientHttpAttributesGetter()) .buildClientInstrumenter(HttpHeaderSetter.INSTANCE); } diff --git a/instrumentation/http-url-connection/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpurlconnection/HttpUrlConnectionSingletons.java b/instrumentation/http-url-connection/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpurlconnection/HttpUrlConnectionSingletons.java index 4d7ab3092ec0..31c84a758b70 100644 --- a/instrumentation/http-url-connection/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpurlconnection/HttpUrlConnectionSingletons.java +++ b/instrumentation/http-url-connection/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpurlconnection/HttpUrlConnectionSingletons.java @@ -7,7 +7,7 @@ import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; -import io.opentelemetry.javaagent.bootstrap.internal.HttpClientInstrumenterFactory; +import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenterBuilder; import java.net.HttpURLConnection; public final class HttpUrlConnectionSingletons { @@ -16,7 +16,7 @@ public final class HttpUrlConnectionSingletons { static { INSTRUMENTER = - HttpClientInstrumenterFactory.builder( + JavaagentHttpClientInstrumenterBuilder.create( "io.opentelemetry.http-url-connection", new HttpUrlHttpAttributesGetter()) .addAttributesExtractor( HttpMethodAttributeExtractor.create( diff --git a/instrumentation/java-http-client/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpclient/JavaHttpClientSingletons.java b/instrumentation/java-http-client/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpclient/JavaHttpClientSingletons.java index a5b5fa409ea3..7e097212647f 100644 --- a/instrumentation/java-http-client/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpclient/JavaHttpClientSingletons.java +++ b/instrumentation/java-http-client/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpclient/JavaHttpClientSingletons.java @@ -11,7 +11,6 @@ import io.opentelemetry.instrumentation.httpclient.JavaHttpClientTelemetryBuilder; import io.opentelemetry.instrumentation.httpclient.internal.HttpHeadersSetter; import io.opentelemetry.instrumentation.httpclient.internal.JavaHttpClientAttributesGetter; -import io.opentelemetry.javaagent.bootstrap.internal.HttpClientInstrumenterFactory; import java.net.http.HttpRequest; import java.net.http.HttpResponse; @@ -24,7 +23,7 @@ public class JavaHttpClientSingletons { SETTER = new HttpHeadersSetter(GlobalOpenTelemetry.getPropagators()); INSTRUMENTER = - HttpClientInstrumenterFactory.builder( + ConfiguredHttpClientInstrumenterBuilder.create( JavaHttpClientTelemetryBuilder.INSTRUMENTATION_NAME, JavaHttpClientAttributesGetter.INSTANCE) .buildInstrumenter(SpanKindExtractor.alwaysClient()); diff --git a/instrumentation/java-http-client/library/src/main/java/io/opentelemetry/instrumentation/httpclient/JavaHttpClientTelemetryBuilder.java b/instrumentation/java-http-client/library/src/main/java/io/opentelemetry/instrumentation/httpclient/JavaHttpClientTelemetryBuilder.java index 26f458d4d391..396055a7953f 100644 --- a/instrumentation/java-http-client/library/src/main/java/io/opentelemetry/instrumentation/httpclient/JavaHttpClientTelemetryBuilder.java +++ b/instrumentation/java-http-client/library/src/main/java/io/opentelemetry/instrumentation/httpclient/JavaHttpClientTelemetryBuilder.java @@ -6,7 +6,7 @@ package io.opentelemetry.instrumentation.httpclient; import io.opentelemetry.api.OpenTelemetry; -import io.opentelemetry.instrumentation.api.incubator.builder.HttpClientConfigBuilder; +import io.opentelemetry.instrumentation.api.incubator.builder.AbstractHttpClientTelemetryBuilder; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.SpanKindExtractor; import io.opentelemetry.instrumentation.httpclient.internal.HttpHeadersSetter; @@ -15,7 +15,8 @@ import java.net.http.HttpResponse; public final class JavaHttpClientTelemetryBuilder - extends HttpClientConfigBuilder> { + extends AbstractHttpClientTelemetryBuilder< + JavaHttpClientTelemetryBuilder, HttpRequest, HttpResponse> { public static final String INSTRUMENTATION_NAME = "io.opentelemetry.java-http-client"; diff --git a/instrumentation/jetty-httpclient/jetty-httpclient-9.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jetty/httpclient/v9_2/JettyHttpClientSingletons.java b/instrumentation/jetty-httpclient/jetty-httpclient-9.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jetty/httpclient/v9_2/JettyHttpClientSingletons.java index ae9b42143894..a2f8dc58b855 100644 --- a/instrumentation/jetty-httpclient/jetty-httpclient-9.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jetty/httpclient/v9_2/JettyHttpClientSingletons.java +++ b/instrumentation/jetty-httpclient/jetty-httpclient-9.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jetty/httpclient/v9_2/JettyHttpClientSingletons.java @@ -9,14 +9,14 @@ import io.opentelemetry.instrumentation.jetty.httpclient.v9_2.JettyClientTelemetry; import io.opentelemetry.instrumentation.jetty.httpclient.v9_2.internal.HttpHeaderSetter; import io.opentelemetry.instrumentation.jetty.httpclient.v9_2.internal.JettyClientHttpAttributesGetter; -import io.opentelemetry.javaagent.bootstrap.internal.HttpClientInstrumenterFactory; +import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenterBuilder; import org.eclipse.jetty.client.api.Request; import org.eclipse.jetty.client.api.Response; public class JettyHttpClientSingletons { private static final Instrumenter INSTRUMENTER = - HttpClientInstrumenterFactory.builder( + JavaagentHttpClientInstrumenterBuilder.create( JettyClientTelemetry.INSTRUMENTATION_NAME, JettyClientHttpAttributesGetter.INSTANCE) .buildClientInstrumenter(HttpHeaderSetter.INSTANCE); diff --git a/instrumentation/jetty-httpclient/jetty-httpclient-9.2/library/src/main/java/io/opentelemetry/instrumentation/jetty/httpclient/v9_2/JettyClientTelemetryBuilder.java b/instrumentation/jetty-httpclient/jetty-httpclient-9.2/library/src/main/java/io/opentelemetry/instrumentation/jetty/httpclient/v9_2/JettyClientTelemetryBuilder.java index 8711b5441b1a..2d0a8d71b832 100644 --- a/instrumentation/jetty-httpclient/jetty-httpclient-9.2/library/src/main/java/io/opentelemetry/instrumentation/jetty/httpclient/v9_2/JettyClientTelemetryBuilder.java +++ b/instrumentation/jetty-httpclient/jetty-httpclient-9.2/library/src/main/java/io/opentelemetry/instrumentation/jetty/httpclient/v9_2/JettyClientTelemetryBuilder.java @@ -7,7 +7,7 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import io.opentelemetry.api.OpenTelemetry; -import io.opentelemetry.instrumentation.api.incubator.builder.HttpClientConfigBuilder; +import io.opentelemetry.instrumentation.api.incubator.builder.AbstractHttpClientTelemetryBuilder; import io.opentelemetry.instrumentation.jetty.httpclient.v9_2.internal.HttpHeaderSetter; import io.opentelemetry.instrumentation.jetty.httpclient.v9_2.internal.JettyClientHttpAttributesGetter; import org.eclipse.jetty.client.HttpClientTransport; @@ -17,7 +17,7 @@ /** A builder of {@link JettyClientTelemetry}. */ public final class JettyClientTelemetryBuilder - extends HttpClientConfigBuilder { + extends AbstractHttpClientTelemetryBuilder { private HttpClientTransport httpClientTransport; private SslContextFactory sslContextFactory; diff --git a/instrumentation/jodd-http-4.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/joddhttp/v4_2/JoddHttpSingletons.java b/instrumentation/jodd-http-4.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/joddhttp/v4_2/JoddHttpSingletons.java index a3f67780326c..28be1e5b8c84 100644 --- a/instrumentation/jodd-http-4.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/joddhttp/v4_2/JoddHttpSingletons.java +++ b/instrumentation/jodd-http-4.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/joddhttp/v4_2/JoddHttpSingletons.java @@ -6,7 +6,7 @@ package io.opentelemetry.javaagent.instrumentation.joddhttp.v4_2; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; -import io.opentelemetry.javaagent.bootstrap.internal.HttpClientInstrumenterFactory; +import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenterBuilder; import jodd.http.HttpRequest; import jodd.http.HttpResponse; @@ -17,7 +17,7 @@ public final class JoddHttpSingletons { static { INSTRUMENTER = - HttpClientInstrumenterFactory.builder( + JavaagentHttpClientInstrumenterBuilder.create( INSTRUMENTATION_NAME, new JoddHttpHttpAttributesGetter()) .buildClientInstrumenter(HttpHeaderSetter.INSTANCE); } diff --git a/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/NettyClientSingletons.java b/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/NettyClientSingletons.java index dc27ceb31a88..8ca4e7d9a423 100644 --- a/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/NettyClientSingletons.java +++ b/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/NettyClientSingletons.java @@ -13,7 +13,7 @@ import io.opentelemetry.instrumentation.netty.common.internal.NettyConnectionRequest; import io.opentelemetry.instrumentation.netty.common.internal.NettyErrorHolder; import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; -import io.opentelemetry.javaagent.bootstrap.internal.HttpClientInstrumenterFactory; +import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenterBuilder; import io.opentelemetry.javaagent.instrumentation.netty.v3_8.HttpRequestAndChannel; import org.jboss.netty.channel.Channel; import org.jboss.netty.handler.codec.http.HttpResponse; @@ -27,7 +27,7 @@ public final class NettyClientSingletons { static { INSTRUMENTER = - HttpClientInstrumenterFactory.builder( + JavaagentHttpClientInstrumenterBuilder.create( INSTRUMENTATION_NAME, new NettyHttpClientAttributesGetter()) .addContextCustomizer( (context, requestAndChannel, startAttributes) -> NettyErrorHolder.init(context)) diff --git a/instrumentation/okhttp/okhttp-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/okhttp/v2_2/OkHttp2Singletons.java b/instrumentation/okhttp/okhttp-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/okhttp/v2_2/OkHttp2Singletons.java index 27252106206c..68a51f13e871 100644 --- a/instrumentation/okhttp/okhttp-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/okhttp/v2_2/OkHttp2Singletons.java +++ b/instrumentation/okhttp/okhttp-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/okhttp/v2_2/OkHttp2Singletons.java @@ -12,7 +12,7 @@ import com.squareup.okhttp.Response; import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; -import io.opentelemetry.javaagent.bootstrap.internal.HttpClientInstrumenterFactory; +import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenterBuilder; public final class OkHttp2Singletons { private static final String INSTRUMENTATION_NAME = "io.opentelemetry.okhttp-2.2"; @@ -22,7 +22,7 @@ public final class OkHttp2Singletons { static { INSTRUMENTER = - HttpClientInstrumenterFactory.builder( + JavaagentHttpClientInstrumenterBuilder.create( INSTRUMENTATION_NAME, new OkHttp2HttpAttributesGetter()) .buildInstrumenter(alwaysClient()); diff --git a/instrumentation/pekko/pekko-http-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/pekkohttp/v1_0/client/PekkoHttpClientSingletons.java b/instrumentation/pekko/pekko-http-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/pekkohttp/v1_0/client/PekkoHttpClientSingletons.java index 1cdf81563162..531aaf6074e3 100644 --- a/instrumentation/pekko/pekko-http-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/pekkohttp/v1_0/client/PekkoHttpClientSingletons.java +++ b/instrumentation/pekko/pekko-http-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/pekkohttp/v1_0/client/PekkoHttpClientSingletons.java @@ -8,7 +8,7 @@ import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.SpanKindExtractor; -import io.opentelemetry.javaagent.bootstrap.internal.HttpClientInstrumenterFactory; +import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenterBuilder; import io.opentelemetry.javaagent.instrumentation.pekkohttp.v1_0.PekkoHttpUtil; import org.apache.pekko.http.scaladsl.model.HttpRequest; import org.apache.pekko.http.scaladsl.model.HttpResponse; @@ -22,7 +22,7 @@ public class PekkoHttpClientSingletons { SETTER = new HttpHeaderSetter(GlobalOpenTelemetry.getPropagators()); INSTRUMENTER = - HttpClientInstrumenterFactory.builder( + JavaagentHttpClientInstrumenterBuilder.create( PekkoHttpUtil.instrumentationName(), new PekkoHttpClientAttributesGetter()) .buildInstrumenter(SpanKindExtractor.alwaysClient()); } diff --git a/instrumentation/play/play-ws/play-ws-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/playws/PlayWsClientInstrumenterFactory.java b/instrumentation/play/play-ws/play-ws-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/playws/PlayWsClientInstrumenterFactory.java index ca6feff81e88..06cdac3154a5 100644 --- a/instrumentation/play/play-ws/play-ws-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/playws/PlayWsClientInstrumenterFactory.java +++ b/instrumentation/play/play-ws/play-ws-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/playws/PlayWsClientInstrumenterFactory.java @@ -6,14 +6,14 @@ package io.opentelemetry.javaagent.instrumentation.playws; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; -import io.opentelemetry.javaagent.bootstrap.internal.HttpClientInstrumenterFactory; +import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenterBuilder; import play.shaded.ahc.org.asynchttpclient.Request; import play.shaded.ahc.org.asynchttpclient.Response; public final class PlayWsClientInstrumenterFactory { public static Instrumenter createInstrumenter(String instrumentationName) { - return HttpClientInstrumenterFactory.builder( + return JavaagentHttpClientInstrumenterBuilder.create( instrumentationName, new PlayWsClientHttpAttributesGetter()) .buildClientInstrumenter(HttpHeaderSetter.INSTANCE); } diff --git a/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettySingletons.java b/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettySingletons.java index a59969b1f2c0..341d761053e6 100644 --- a/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettySingletons.java +++ b/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettySingletons.java @@ -11,7 +11,7 @@ import io.opentelemetry.instrumentation.netty.v4.common.internal.client.NettyConnectionInstrumentationFlag; import io.opentelemetry.instrumentation.netty.v4.common.internal.client.NettyConnectionInstrumenter; import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig; -import io.opentelemetry.javaagent.bootstrap.internal.HttpClientInstrumenterFactory; +import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenterBuilder; import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; import reactor.netty.http.client.HttpClientRequest; import reactor.netty.http.client.HttpClientResponse; @@ -29,7 +29,7 @@ public final class ReactorNettySingletons { static { INSTRUMENTER = - HttpClientInstrumenterFactory.builder( + JavaagentHttpClientInstrumenterBuilder.create( INSTRUMENTATION_NAME, new ReactorNettyHttpClientAttributesGetter()) .buildClientInstrumenter(HttpClientRequestHeadersSetter.INSTANCE); diff --git a/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/SpringWebTelemetryBuilder.java b/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/SpringWebTelemetryBuilder.java index 82e333ce3479..daf5680865d9 100644 --- a/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/SpringWebTelemetryBuilder.java +++ b/instrumentation/spring/spring-web/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/v3_1/SpringWebTelemetryBuilder.java @@ -6,13 +6,14 @@ package io.opentelemetry.instrumentation.spring.web.v3_1; import io.opentelemetry.api.OpenTelemetry; -import io.opentelemetry.instrumentation.api.incubator.builder.HttpClientConfigBuilder; +import io.opentelemetry.instrumentation.api.incubator.builder.AbstractHttpClientTelemetryBuilder; import org.springframework.http.HttpRequest; import org.springframework.http.client.ClientHttpResponse; /** A builder of {@link SpringWebTelemetry}. */ public final class SpringWebTelemetryBuilder - extends HttpClientConfigBuilder { + extends AbstractHttpClientTelemetryBuilder< + SpringWebTelemetryBuilder, HttpRequest, ClientHttpResponse> { private static final String INSTRUMENTATION_NAME = "io.opentelemetry.spring-web-3.1"; SpringWebTelemetryBuilder(OpenTelemetry openTelemetry) { diff --git a/instrumentation/vertx/vertx-http-client/vertx-http-client-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/client/VertxClientInstrumenterFactory.java b/instrumentation/vertx/vertx-http-client/vertx-http-client-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/client/VertxClientInstrumenterFactory.java index 97016aa6bfc3..d0fbebc51fd8 100644 --- a/instrumentation/vertx/vertx-http-client/vertx-http-client-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/client/VertxClientInstrumenterFactory.java +++ b/instrumentation/vertx/vertx-http-client/vertx-http-client-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/client/VertxClientInstrumenterFactory.java @@ -6,7 +6,7 @@ package io.opentelemetry.javaagent.instrumentation.vertx.client; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; -import io.opentelemetry.javaagent.bootstrap.internal.HttpClientInstrumenterFactory; +import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenterBuilder; import io.vertx.core.http.HttpClientRequest; import io.vertx.core.http.HttpClientResponse; @@ -15,7 +15,7 @@ public final class VertxClientInstrumenterFactory { public static Instrumenter create( String instrumentationName, AbstractVertxHttpAttributesGetter httpAttributesGetter) { - return HttpClientInstrumenterFactory.builder(instrumentationName, httpAttributesGetter) + return JavaagentHttpClientInstrumenterBuilder.create(instrumentationName, httpAttributesGetter) .buildClientInstrumenter(new HttpRequestHeaderSetter()); } diff --git a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/HttpClientInstrumenterFactory.java b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/JavaagentHttpClientInstrumenterBuilder.java similarity index 60% rename from javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/HttpClientInstrumenterFactory.java rename to javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/JavaagentHttpClientInstrumenterBuilder.java index df93fc96f999..c66476af976d 100644 --- a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/HttpClientInstrumenterFactory.java +++ b/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/JavaagentHttpClientInstrumenterBuilder.java @@ -7,7 +7,7 @@ import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.OpenTelemetry; -import io.opentelemetry.instrumentation.api.incubator.builder.HttpClientConfigBuilder; +import io.opentelemetry.instrumentation.api.incubator.builder.AbstractHttpClientTelemetryBuilder; import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder; import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesGetter; import java.util.function.Consumer; @@ -18,15 +18,17 @@ * any time. */ @SuppressWarnings("rawtypes") -public final class HttpClientInstrumenterFactory { +public class JavaagentHttpClientInstrumenterBuilder + extends AbstractHttpClientTelemetryBuilder< + JavaagentHttpClientInstrumenterBuilder, REQUEST, RESPONSE> { - private HttpClientInstrumenterFactory() {} - - public static InstrumenterBuilder builder( + public static InstrumenterBuilder create( String instrumentationName, HttpClientAttributesGetter httpAttributesGetter) { - Builder builder = - new Builder<>(instrumentationName, GlobalOpenTelemetry.get(), httpAttributesGetter); + + JavaagentHttpClientInstrumenterBuilder builder = + new JavaagentHttpClientInstrumenterBuilder<>( + instrumentationName, GlobalOpenTelemetry.get(), httpAttributesGetter); CommonConfig config = CommonConfig.get(); set(config::getKnownHttpRequestMethods, builder::setKnownMethods); set(config::getClientRequestHeaders, builder::setCapturedRequestHeaders); @@ -38,29 +40,17 @@ public static InstrumenterBuilder builder return builder.instrumenterBuilder(); } + private JavaagentHttpClientInstrumenterBuilder( + String instrumentationName, + OpenTelemetry openTelemetry, + HttpClientAttributesGetter attributesGetter) { + super(instrumentationName, openTelemetry, attributesGetter); + } + private static void set(Supplier supplier, Consumer consumer) { T t = supplier.get(); if (t != null) { consumer.accept(t); } } - - /** - * This class is internal and is hence not for public use. Its APIs are unstable and can change at - * any time. - */ - public static class Builder - extends HttpClientConfigBuilder { - Builder( - String instrumentationName, - OpenTelemetry openTelemetry, - HttpClientAttributesGetter httpAttributesGetter) { - super(instrumentationName, openTelemetry, httpAttributesGetter); - } - - @Override - public InstrumenterBuilder instrumenterBuilder() { - return super.instrumenterBuilder(); - } - } }