From 4cc4e1c0b2504d202f07c745fdecb9a58926c7a5 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Tue, 10 Dec 2024 12:45:20 -0800 Subject: [PATCH] Consistent naming of addAttributesExtractor (#12860) --- .../DefaultHttpClientInstrumenterBuilder.java | 6 +++--- .../v4_3/ApacheHttpClientTelemetryBuilder.java | 17 ++++++++++++++++- .../v5_2/ApacheHttpClient5TelemetryBuilder.java | 2 +- .../armeria/v1_3/ArmeriaTelemetryBuilder.java | 4 ++-- .../grpc/v1_6/GrpcTelemetryBuilder.java | 14 ++++++++++++++ .../instrumentation/grpc/v1_6/GrpcTest.java | 4 ++-- .../JavaHttpClientTelemetryBuilder.java | 16 +++++++++++++++- .../v12_0/JettyClientTelemetryBuilder.java | 16 +++++++++++++++- .../v9_2/JettyClientTelemetryBuilder.java | 16 +++++++++++++++- .../client/AbstractKtorClientTracingBuilder.kt | 2 +- .../netty/v4_1/NettyClientTelemetryBuilder.java | 2 +- .../okhttp/v3_0/OkHttpTelemetryBuilder.java | 16 +++++++++++++++- .../quartz/v2_0/QuartzTelemetryBuilder.java | 14 ++++++++++++++ .../r2dbc/v1_0/R2dbcSingletons.java | 2 +- .../r2dbc/v1_0/R2dbcTelemetryBuilder.java | 13 ++++++++++++- .../v1_0/internal/R2dbcInstrumenterBuilder.java | 2 +- .../ratpack/v1_7/RatpackTelemetryBuilder.java | 2 +- .../web/v3_1/SpringWebTelemetryBuilder.java | 16 +++++++++++++++- .../v5_3/SpringWebfluxTelemetryBuilder.java | 2 +- 19 files changed, 145 insertions(+), 21 deletions(-) diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/DefaultHttpClientInstrumenterBuilder.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/DefaultHttpClientInstrumenterBuilder.java index d2ef015383d9..e74dd2e9f48c 100644 --- a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/DefaultHttpClientInstrumenterBuilder.java +++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/DefaultHttpClientInstrumenterBuilder.java @@ -103,7 +103,7 @@ public static DefaultHttpClientInstrumenterBuilder addAttributeExtractor( + public DefaultHttpClientInstrumenterBuilder addAttributesExtractor( AttributesExtractor attributesExtractor) { additionalExtractors.add(attributesExtractor); return this; @@ -190,7 +190,7 @@ public DefaultHttpClientInstrumenterBuilder setSpanNameExtrac @CanIgnoreReturnValue public DefaultHttpClientInstrumenterBuilder setPeerServiceResolver( PeerServiceResolver peerServiceResolver) { - return addAttributeExtractor( + return addAttributesExtractor( HttpClientPeerServiceAttributesExtractor.create(attributesGetter, peerServiceResolver)); } @@ -198,7 +198,7 @@ public DefaultHttpClientInstrumenterBuilder setPeerServiceRes @CanIgnoreReturnValue public DefaultHttpClientInstrumenterBuilder setPeerService( String peerService) { - return addAttributeExtractor(AttributesExtractor.constant(PEER_SERVICE, peerService)); + return addAttributesExtractor(AttributesExtractor.constant(PEER_SERVICE, peerService)); } @CanIgnoreReturnValue 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 1d0d497317b9..d79c6f2cab6f 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 @@ -33,12 +33,27 @@ public final class ApacheHttpClientTelemetryBuilder { /** * Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented * items. The {@link AttributesExtractor} will be executed after all default extractors. + * + * @deprecated Use {@link #addAttributesExtractor(AttributesExtractor)} instead. */ + @Deprecated @CanIgnoreReturnValue public ApacheHttpClientTelemetryBuilder addAttributeExtractor( AttributesExtractor attributesExtractor) { - builder.addAttributeExtractor(attributesExtractor); + builder.addAttributesExtractor(attributesExtractor); + return this; + } + + /** + * Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented + * items. The {@link AttributesExtractor} will be executed after all default extractors. + */ + @CanIgnoreReturnValue + public ApacheHttpClientTelemetryBuilder addAttributesExtractor( + AttributesExtractor + attributesExtractor) { + builder.addAttributesExtractor(attributesExtractor); return this; } diff --git a/instrumentation/apache-httpclient/apache-httpclient-5.2/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v5_2/ApacheHttpClient5TelemetryBuilder.java b/instrumentation/apache-httpclient/apache-httpclient-5.2/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v5_2/ApacheHttpClient5TelemetryBuilder.java index 8d7b323462cf..8ac49495d0b2 100644 --- a/instrumentation/apache-httpclient/apache-httpclient-5.2/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v5_2/ApacheHttpClient5TelemetryBuilder.java +++ b/instrumentation/apache-httpclient/apache-httpclient-5.2/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v5_2/ApacheHttpClient5TelemetryBuilder.java @@ -39,7 +39,7 @@ public final class ApacheHttpClient5TelemetryBuilder { public ApacheHttpClient5TelemetryBuilder addAttributeExtractor( AttributesExtractor attributesExtractor) { - builder.addAttributeExtractor(attributesExtractor); + builder.addAttributesExtractor(attributesExtractor); return this; } diff --git a/instrumentation/armeria/armeria-1.3/library/src/main/java/io/opentelemetry/instrumentation/armeria/v1_3/ArmeriaTelemetryBuilder.java b/instrumentation/armeria/armeria-1.3/library/src/main/java/io/opentelemetry/instrumentation/armeria/v1_3/ArmeriaTelemetryBuilder.java index 5d6a17eb6586..d52523795615 100644 --- a/instrumentation/armeria/armeria-1.3/library/src/main/java/io/opentelemetry/instrumentation/armeria/v1_3/ArmeriaTelemetryBuilder.java +++ b/instrumentation/armeria/armeria-1.3/library/src/main/java/io/opentelemetry/instrumentation/armeria/v1_3/ArmeriaTelemetryBuilder.java @@ -95,7 +95,7 @@ public ArmeriaTelemetryBuilder setServerStatusExtractor( @CanIgnoreReturnValue public ArmeriaTelemetryBuilder addAttributeExtractor( AttributesExtractor attributesExtractor) { - clientBuilder.addAttributeExtractor(attributesExtractor); + clientBuilder.addAttributesExtractor(attributesExtractor); serverBuilder.addAttributesExtractor(attributesExtractor); return this; } @@ -108,7 +108,7 @@ public ArmeriaTelemetryBuilder addAttributeExtractor( @CanIgnoreReturnValue public ArmeriaTelemetryBuilder addClientAttributeExtractor( AttributesExtractor attributesExtractor) { - clientBuilder.addAttributeExtractor(attributesExtractor); + clientBuilder.addAttributesExtractor(attributesExtractor); return this; } diff --git a/instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcTelemetryBuilder.java b/instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcTelemetryBuilder.java index 98a9ae52ed94..0e1240158d71 100644 --- a/instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcTelemetryBuilder.java +++ b/instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcTelemetryBuilder.java @@ -59,7 +59,10 @@ public final class GrpcTelemetryBuilder { /** * Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented * items. The {@link AttributesExtractor} will be executed after all default extractors. + * + * @deprecated Use {@link #addAttributesExtractor(AttributesExtractor)} instead. */ + @Deprecated @CanIgnoreReturnValue public GrpcTelemetryBuilder addAttributeExtractor( AttributesExtractor attributesExtractor) { @@ -67,6 +70,17 @@ public GrpcTelemetryBuilder addAttributeExtractor( return this; } + /** + * Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented + * items. The {@link AttributesExtractor} will be executed after all default extractors. + */ + @CanIgnoreReturnValue + public GrpcTelemetryBuilder addAttributesExtractor( + AttributesExtractor attributesExtractor) { + additionalExtractors.add(attributesExtractor); + return this; + } + /** * Adds an extra client-only {@link AttributesExtractor} to invoke to set attributes to * instrumented items. The {@link AttributesExtractor} will be executed after all default diff --git a/instrumentation/grpc-1.6/library/src/test/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcTest.java b/instrumentation/grpc-1.6/library/src/test/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcTest.java index 5aa6f1aa9a41..36b27c83fbed 100644 --- a/instrumentation/grpc-1.6/library/src/test/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcTest.java +++ b/instrumentation/grpc-1.6/library/src/test/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcTest.java @@ -91,7 +91,7 @@ public void sayHello( .addService(greeter) .intercept( GrpcTelemetry.builder(testing.getOpenTelemetry()) - .addAttributeExtractor(new CustomAttributesExtractor()) + .addAttributesExtractor(new CustomAttributesExtractor()) .addServerAttributeExtractor(new CustomAttributesExtractorV2("serverSideValue")) .build() .newServerInterceptor()) @@ -103,7 +103,7 @@ public void sayHello( ManagedChannelBuilder.forAddress("localhost", server.getPort()) .intercept( GrpcTelemetry.builder(testing.getOpenTelemetry()) - .addAttributeExtractor(new CustomAttributesExtractor()) + .addAttributesExtractor(new CustomAttributesExtractor()) .addClientAttributeExtractor( new CustomAttributesExtractorV2("clientSideValue")) .build() 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 ae2040ffcc96..99c823609619 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 @@ -32,11 +32,25 @@ public final class JavaHttpClientTelemetryBuilder { /** * Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented * items. The {@link AttributesExtractor} will be executed after all default extractors. + * + * @deprecated Use {@link #addAttributesExtractor(AttributesExtractor)} instead. */ + @Deprecated @CanIgnoreReturnValue public JavaHttpClientTelemetryBuilder addAttributeExtractor( AttributesExtractor> attributesExtractor) { - builder.addAttributeExtractor(attributesExtractor); + builder.addAttributesExtractor(attributesExtractor); + return this; + } + + /** + * Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented + * items. The {@link AttributesExtractor} will be executed after all default extractors. + */ + @CanIgnoreReturnValue + public JavaHttpClientTelemetryBuilder addAttributesExtractor( + AttributesExtractor> attributesExtractor) { + builder.addAttributesExtractor(attributesExtractor); return this; } diff --git a/instrumentation/jetty-httpclient/jetty-httpclient-12.0/library/src/main/java/io/opentelemetry/instrumentation/jetty/httpclient/v12_0/JettyClientTelemetryBuilder.java b/instrumentation/jetty-httpclient/jetty-httpclient-12.0/library/src/main/java/io/opentelemetry/instrumentation/jetty/httpclient/v12_0/JettyClientTelemetryBuilder.java index ec5c8b379d50..aa137d18baf1 100644 --- a/instrumentation/jetty-httpclient/jetty-httpclient-12.0/library/src/main/java/io/opentelemetry/instrumentation/jetty/httpclient/v12_0/JettyClientTelemetryBuilder.java +++ b/instrumentation/jetty-httpclient/jetty-httpclient-12.0/library/src/main/java/io/opentelemetry/instrumentation/jetty/httpclient/v12_0/JettyClientTelemetryBuilder.java @@ -47,11 +47,25 @@ public JettyClientTelemetryBuilder setSslContextFactory( /** * Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented * items. + * + * @deprecated Use {@link #addAttributesExtractor(AttributesExtractor)} instead. */ + @Deprecated @CanIgnoreReturnValue public JettyClientTelemetryBuilder addAttributeExtractor( AttributesExtractor attributesExtractor) { - builder.addAttributeExtractor(attributesExtractor); + builder.addAttributesExtractor(attributesExtractor); + return this; + } + + /** + * Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented + * items. + */ + @CanIgnoreReturnValue + public JettyClientTelemetryBuilder addAttributesExtractor( + AttributesExtractor attributesExtractor) { + builder.addAttributesExtractor(attributesExtractor); return this; } 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 a976fe7a2f30..c414967a315a 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 @@ -47,11 +47,25 @@ public JettyClientTelemetryBuilder setSslContextFactory(SslContextFactory sslCon /** * Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented * items. + * + * @deprecated Use {@link #addAttributesExtractor(AttributesExtractor)} instead. */ + @Deprecated @CanIgnoreReturnValue public JettyClientTelemetryBuilder addAttributeExtractor( AttributesExtractor attributesExtractor) { - builder.addAttributeExtractor(attributesExtractor); + builder.addAttributesExtractor(attributesExtractor); + return this; + } + + /** + * Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented + * items. + */ + @CanIgnoreReturnValue + public JettyClientTelemetryBuilder addAttributesExtractor( + AttributesExtractor attributesExtractor) { + builder.addAttributesExtractor(attributesExtractor); return this; } diff --git a/instrumentation/ktor/ktor-2-common/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/client/AbstractKtorClientTracingBuilder.kt b/instrumentation/ktor/ktor-2-common/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/client/AbstractKtorClientTracingBuilder.kt index 3b99bba1f6af..ddc480ed079d 100644 --- a/instrumentation/ktor/ktor-2-common/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/client/AbstractKtorClientTracingBuilder.kt +++ b/instrumentation/ktor/ktor-2-common/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/client/AbstractKtorClientTracingBuilder.kt @@ -108,7 +108,7 @@ abstract class AbstractKtorClientTracingBuilder( fun attributeExtractor(extractorBuilder: ExtractorBuilder.() -> Unit = {}) { val builder = ExtractorBuilder().apply(extractorBuilder).build() - this.clientBuilder.addAttributeExtractor( + this.clientBuilder.addAttributesExtractor( object : AttributesExtractor { override fun onStart(attributes: AttributesBuilder, parentContext: Context, request: HttpRequestData) { builder.onStart(OnStartData(attributes, parentContext, request)) diff --git a/instrumentation/netty/netty-4.1/library/src/main/java/io/opentelemetry/instrumentation/netty/v4_1/NettyClientTelemetryBuilder.java b/instrumentation/netty/netty-4.1/library/src/main/java/io/opentelemetry/instrumentation/netty/v4_1/NettyClientTelemetryBuilder.java index a7e3b8d61bb3..d43c09ee4431 100644 --- a/instrumentation/netty/netty-4.1/library/src/main/java/io/opentelemetry/instrumentation/netty/v4_1/NettyClientTelemetryBuilder.java +++ b/instrumentation/netty/netty-4.1/library/src/main/java/io/opentelemetry/instrumentation/netty/v4_1/NettyClientTelemetryBuilder.java @@ -69,7 +69,7 @@ public NettyClientTelemetryBuilder setCapturedResponseHeaders( @CanIgnoreReturnValue public NettyClientTelemetryBuilder addAttributesExtractor( AttributesExtractor attributesExtractor) { - builder.addAttributeExtractor(attributesExtractor); + builder.addAttributesExtractor(attributesExtractor); return this; } diff --git a/instrumentation/okhttp/okhttp-3.0/library/src/main/java/io/opentelemetry/instrumentation/okhttp/v3_0/OkHttpTelemetryBuilder.java b/instrumentation/okhttp/okhttp-3.0/library/src/main/java/io/opentelemetry/instrumentation/okhttp/v3_0/OkHttpTelemetryBuilder.java index 3595aaa91a20..a6f642c346d0 100644 --- a/instrumentation/okhttp/okhttp-3.0/library/src/main/java/io/opentelemetry/instrumentation/okhttp/v3_0/OkHttpTelemetryBuilder.java +++ b/instrumentation/okhttp/okhttp-3.0/library/src/main/java/io/opentelemetry/instrumentation/okhttp/v3_0/OkHttpTelemetryBuilder.java @@ -32,11 +32,25 @@ public final class OkHttpTelemetryBuilder { /** * Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented * items. + * + * @deprecated Use {@link #addAttributesExtractor(AttributesExtractor)} instead. */ + @Deprecated @CanIgnoreReturnValue public OkHttpTelemetryBuilder addAttributeExtractor( AttributesExtractor attributesExtractor) { - builder.addAttributeExtractor(attributesExtractor); + builder.addAttributesExtractor(attributesExtractor); + return this; + } + + /** + * Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented + * items. + */ + @CanIgnoreReturnValue + public OkHttpTelemetryBuilder addAttributesExtractor( + AttributesExtractor attributesExtractor) { + builder.addAttributesExtractor(attributesExtractor); return this; } diff --git a/instrumentation/quartz-2.0/library/src/main/java/io/opentelemetry/instrumentation/quartz/v2_0/QuartzTelemetryBuilder.java b/instrumentation/quartz-2.0/library/src/main/java/io/opentelemetry/instrumentation/quartz/v2_0/QuartzTelemetryBuilder.java index 27269c4b45e1..e857de5f9398 100644 --- a/instrumentation/quartz-2.0/library/src/main/java/io/opentelemetry/instrumentation/quartz/v2_0/QuartzTelemetryBuilder.java +++ b/instrumentation/quartz-2.0/library/src/main/java/io/opentelemetry/instrumentation/quartz/v2_0/QuartzTelemetryBuilder.java @@ -38,7 +38,10 @@ public final class QuartzTelemetryBuilder { /** * Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented * items. The {@link AttributesExtractor} will be executed after all default extractors. + * + * @deprecated Use {@link #addAttributesExtractor(AttributesExtractor)} instead. */ + @Deprecated @CanIgnoreReturnValue public QuartzTelemetryBuilder addAttributeExtractor( AttributesExtractor attributesExtractor) { @@ -46,6 +49,17 @@ public QuartzTelemetryBuilder addAttributeExtractor( return this; } + /** + * Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented + * items. The {@link AttributesExtractor} will be executed after all default extractors. + */ + @CanIgnoreReturnValue + public QuartzTelemetryBuilder addAttributesExtractor( + AttributesExtractor attributesExtractor) { + additionalExtractors.add(attributesExtractor); + return this; + } + /** * Sets whether experimental attributes should be set to spans. These attributes may be changed or * removed in the future, so only enable this if you know you do not require attributes filled by diff --git a/instrumentation/r2dbc-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/r2dbc/v1_0/R2dbcSingletons.java b/instrumentation/r2dbc-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/r2dbc/v1_0/R2dbcSingletons.java index 36ebe81accbf..e733a77f8a0e 100644 --- a/instrumentation/r2dbc-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/r2dbc/v1_0/R2dbcSingletons.java +++ b/instrumentation/r2dbc-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/r2dbc/v1_0/R2dbcSingletons.java @@ -21,7 +21,7 @@ public final class R2dbcSingletons { .getBoolean( "otel.instrumentation.r2dbc.statement-sanitizer.enabled", AgentCommonConfig.get().isStatementSanitizationEnabled())) - .addAttributeExtractor( + .addAttributesExtractor( PeerServiceAttributesExtractor.create( R2dbcNetAttributesGetter.INSTANCE, AgentCommonConfig.get().getPeerServiceResolver())) diff --git a/instrumentation/r2dbc-1.0/library/src/main/java/io/opentelemetry/instrumentation/r2dbc/v1_0/R2dbcTelemetryBuilder.java b/instrumentation/r2dbc-1.0/library/src/main/java/io/opentelemetry/instrumentation/r2dbc/v1_0/R2dbcTelemetryBuilder.java index 3cd1f16e0eaf..413212a8eb2d 100644 --- a/instrumentation/r2dbc-1.0/library/src/main/java/io/opentelemetry/instrumentation/r2dbc/v1_0/R2dbcTelemetryBuilder.java +++ b/instrumentation/r2dbc-1.0/library/src/main/java/io/opentelemetry/instrumentation/r2dbc/v1_0/R2dbcTelemetryBuilder.java @@ -25,10 +25,21 @@ public final class R2dbcTelemetryBuilder { instrumenterBuilder = new R2dbcInstrumenterBuilder(openTelemetry); } + /** + * @deprecated Use {@link #addAttributesExtractor(AttributesExtractor)} instead. + */ + @Deprecated @CanIgnoreReturnValue public R2dbcTelemetryBuilder addAttributeExtractor( AttributesExtractor attributesExtractor) { - instrumenterBuilder.addAttributeExtractor(attributesExtractor); + instrumenterBuilder.addAttributesExtractor(attributesExtractor); + return this; + } + + @CanIgnoreReturnValue + public R2dbcTelemetryBuilder addAttributesExtractor( + AttributesExtractor attributesExtractor) { + instrumenterBuilder.addAttributesExtractor(attributesExtractor); return this; } diff --git a/instrumentation/r2dbc-1.0/library/src/main/java/io/opentelemetry/instrumentation/r2dbc/v1_0/internal/R2dbcInstrumenterBuilder.java b/instrumentation/r2dbc-1.0/library/src/main/java/io/opentelemetry/instrumentation/r2dbc/v1_0/internal/R2dbcInstrumenterBuilder.java index f094125633bb..6db0f3a48caf 100644 --- a/instrumentation/r2dbc-1.0/library/src/main/java/io/opentelemetry/instrumentation/r2dbc/v1_0/internal/R2dbcInstrumenterBuilder.java +++ b/instrumentation/r2dbc-1.0/library/src/main/java/io/opentelemetry/instrumentation/r2dbc/v1_0/internal/R2dbcInstrumenterBuilder.java @@ -37,7 +37,7 @@ public R2dbcInstrumenterBuilder(OpenTelemetry openTelemetry) { } @CanIgnoreReturnValue - public R2dbcInstrumenterBuilder addAttributeExtractor( + public R2dbcInstrumenterBuilder addAttributesExtractor( AttributesExtractor attributesExtractor) { additionalExtractors.add(attributesExtractor); return this; diff --git a/instrumentation/ratpack/ratpack-1.7/library/src/main/java/io/opentelemetry/instrumentation/ratpack/v1_7/RatpackTelemetryBuilder.java b/instrumentation/ratpack/ratpack-1.7/library/src/main/java/io/opentelemetry/instrumentation/ratpack/v1_7/RatpackTelemetryBuilder.java index 1192a8d8d936..304bb943a31d 100644 --- a/instrumentation/ratpack/ratpack-1.7/library/src/main/java/io/opentelemetry/instrumentation/ratpack/v1_7/RatpackTelemetryBuilder.java +++ b/instrumentation/ratpack/ratpack-1.7/library/src/main/java/io/opentelemetry/instrumentation/ratpack/v1_7/RatpackTelemetryBuilder.java @@ -52,7 +52,7 @@ public RatpackTelemetryBuilder addAttributeExtractor( @CanIgnoreReturnValue public RatpackTelemetryBuilder addClientAttributeExtractor( AttributesExtractor attributesExtractor) { - clientBuilder.addAttributeExtractor(attributesExtractor); + clientBuilder.addAttributesExtractor(attributesExtractor); return this; } 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 86771bfa3313..26c653fe7918 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 @@ -43,11 +43,25 @@ private DefaultHttpClientInstrumenterBuilder ge /** * Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented * items. + * + * @deprecated Use {@link #addAttributesExtractor(AttributesExtractor)} instead. */ + @Deprecated @CanIgnoreReturnValue public SpringWebTelemetryBuilder addAttributeExtractor( AttributesExtractor attributesExtractor) { - builder.addAttributeExtractor(attributesExtractor); + builder.addAttributesExtractor(attributesExtractor); + return this; + } + + /** + * Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented + * items. + */ + @CanIgnoreReturnValue + public SpringWebTelemetryBuilder addAttributesExtractor( + AttributesExtractor attributesExtractor) { + builder.addAttributesExtractor(attributesExtractor); return this; } diff --git a/instrumentation/spring/spring-webflux/spring-webflux-5.3/library/src/main/java/io/opentelemetry/instrumentation/spring/webflux/v5_3/SpringWebfluxTelemetryBuilder.java b/instrumentation/spring/spring-webflux/spring-webflux-5.3/library/src/main/java/io/opentelemetry/instrumentation/spring/webflux/v5_3/SpringWebfluxTelemetryBuilder.java index 602ded9c1d4d..7ecca97596fd 100644 --- a/instrumentation/spring/spring-webflux/spring-webflux-5.3/library/src/main/java/io/opentelemetry/instrumentation/spring/webflux/v5_3/SpringWebfluxTelemetryBuilder.java +++ b/instrumentation/spring/spring-webflux/spring-webflux-5.3/library/src/main/java/io/opentelemetry/instrumentation/spring/webflux/v5_3/SpringWebfluxTelemetryBuilder.java @@ -58,7 +58,7 @@ public final class SpringWebfluxTelemetryBuilder { @CanIgnoreReturnValue public SpringWebfluxTelemetryBuilder addClientAttributesExtractor( AttributesExtractor attributesExtractor) { - clientBuilder.addAttributeExtractor(attributesExtractor); + clientBuilder.addAttributesExtractor(attributesExtractor); return this; }