From 4bcacf21cf2e1ca5fb41f8819f532f4154f46534 Mon Sep 17 00:00:00 2001 From: otelbot <197425009+otelbot@users.noreply.github.com> Date: Thu, 7 May 2026 04:09:25 +0000 Subject: [PATCH 1/6] Cleanup for akka-http-10.0:javaagent - Add declarative metadata names for Akka HTTP instrumentation configs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- instrumentation/akka/akka-http-10.0/metadata.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/instrumentation/akka/akka-http-10.0/metadata.yaml b/instrumentation/akka/akka-http-10.0/metadata.yaml index 02c7f5694d27..f9d29afb9f6c 100644 --- a/instrumentation/akka/akka-http-10.0/metadata.yaml +++ b/instrumentation/akka/akka-http-10.0/metadata.yaml @@ -13,24 +13,29 @@ features: - CONTEXT_PROPAGATION configurations: - name: otel.instrumentation.http.known-methods + declarative_name: java.common.http.known_methods description: > Configures the instrumentation to recognize an alternative set of HTTP request methods. All other methods will be treated as `_OTHER`. type: list default: "CONNECT,DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT,TRACE" - name: otel.instrumentation.http.client.capture-request-headers + declarative_name: general.http.client.request_captured_headers description: List of HTTP request headers to capture in HTTP client telemetry. type: list default: "" - name: otel.instrumentation.http.client.capture-response-headers + declarative_name: general.http.client.response_captured_headers description: List of HTTP response headers to capture in HTTP client telemetry. type: list default: "" - name: otel.instrumentation.common.peer-service-mapping + declarative_name: java.common.peer_service_mapping description: Used to specify a mapping from host names or IP addresses to peer services. type: map default: "" - name: otel.instrumentation.http.client.emit-experimental-telemetry + declarative_name: java.common.http.client.emit_experimental_telemetry/development description: > Enable the capture of experimental HTTP client telemetry. Adds the `http.request.body.size` and `http.response.body.size` attributes to spans, and records `http.client.request.size` and @@ -38,14 +43,17 @@ configurations: type: boolean default: false - name: otel.instrumentation.http.server.capture-request-headers + declarative_name: general.http.server.request_captured_headers description: List of HTTP request headers to capture in HTTP server telemetry. type: list default: "" - name: otel.instrumentation.http.server.capture-response-headers + declarative_name: general.http.server.response_captured_headers description: List of HTTP response headers to capture in HTTP server telemetry. type: list default: "" - name: otel.instrumentation.http.server.emit-experimental-telemetry + declarative_name: java.common.http.server.emit_experimental_telemetry/development description: > Enable the capture of experimental HTTP server telemetry. Adds the `http.request.body.size` and `http.response.body.size` attributes to spans, and records `http.server.request.size` and @@ -53,6 +61,7 @@ configurations: type: boolean default: false - name: otel.instrumentation.sanitization.url.experimental.sensitive-query-parameters + declarative_name: general.sanitization.url.sensitive_query_parameters/development description: List of URL query parameter names whose values are redacted in URL attributes. See https://opentelemetry.io/docs/specs/semconv/http/http-spans. type: list default: "AWSAccessKeyId,Signature,sig,X-Goog-Signature" From f695b99fe2beca459b415f1559697a1f0bb4ee6c Mon Sep 17 00:00:00 2001 From: otelbot <197425009+otelbot@users.noreply.github.com> Date: Thu, 7 May 2026 04:16:18 +0000 Subject: [PATCH 2/6] Cleanup for alibaba-druid-1.0:library - Add public API Javadocs to the Alibaba Druid telemetry entrypoint and metric registration methods Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../instrumentation/alibabadruid/v1_0/DruidTelemetry.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/instrumentation/alibaba-druid-1.0/library/src/main/java/io/opentelemetry/instrumentation/alibabadruid/v1_0/DruidTelemetry.java b/instrumentation/alibaba-druid-1.0/library/src/main/java/io/opentelemetry/instrumentation/alibabadruid/v1_0/DruidTelemetry.java index 5c283be26e72..a96a836e9209 100644 --- a/instrumentation/alibaba-druid-1.0/library/src/main/java/io/opentelemetry/instrumentation/alibabadruid/v1_0/DruidTelemetry.java +++ b/instrumentation/alibaba-druid-1.0/library/src/main/java/io/opentelemetry/instrumentation/alibabadruid/v1_0/DruidTelemetry.java @@ -8,9 +8,11 @@ import com.alibaba.druid.pool.DruidDataSourceMBean; import io.opentelemetry.api.OpenTelemetry; +/** Entrypoint for instrumenting Alibaba Druid database connection pools. */ public final class DruidTelemetry { private final OpenTelemetry openTelemetry; + /** Returns a new {@link DruidTelemetry} configured with the given {@link OpenTelemetry}. */ public static DruidTelemetry create(OpenTelemetry openTelemetry) { return new DruidTelemetry(openTelemetry); } @@ -19,10 +21,12 @@ private DruidTelemetry(OpenTelemetry openTelemetry) { this.openTelemetry = openTelemetry; } + /** Start collecting metrics for given connection pool. */ public void registerMetrics(DruidDataSourceMBean dataSource, String dataSourceName) { ConnectionPoolMetrics.registerMetrics(openTelemetry, dataSource, dataSourceName); } + /** Stop collecting metrics for given connection pool. */ public void unregisterMetrics(DruidDataSourceMBean dataSource) { ConnectionPoolMetrics.unregisterMetrics(dataSource); } From 03d9a296898c445dd8702c4e16ddb1bb48a7f8ae Mon Sep 17 00:00:00 2001 From: otelbot <197425009+otelbot@users.noreply.github.com> Date: Thu, 7 May 2026 04:31:39 +0000 Subject: [PATCH 3/6] Cleanup for apache-dubbo-2.7:library-autoconfigure - Add getter-named DubboRequest accessors and deprecate the older property-style methods per public API naming policy - Update internal library-autoconfigure call sites to use the getter-named accessors Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../apachedubbo/v2_7/DubboHeadersSetter.java | 2 +- .../DubboNetworkServerAttributesGetter.java | 4 +- .../apachedubbo/v2_7/DubboRequest.java | 42 +++++++++++++++++-- .../DubboClientNetworkAttributesGetter.java | 6 +-- 4 files changed, 44 insertions(+), 10 deletions(-) diff --git a/instrumentation/apache-dubbo-2.7/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboHeadersSetter.java b/instrumentation/apache-dubbo-2.7/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboHeadersSetter.java index bd881927c861..41992cc6b21a 100644 --- a/instrumentation/apache-dubbo-2.7/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboHeadersSetter.java +++ b/instrumentation/apache-dubbo-2.7/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboHeadersSetter.java @@ -15,7 +15,7 @@ public void set(@Nullable DubboRequest request, String key, String value) { if (request == null) { return; } - request.context().setAttachment(key, value); + request.getContext().setAttachment(key, value); request.invocation().setAttachment(key, value); } } diff --git a/instrumentation/apache-dubbo-2.7/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboNetworkServerAttributesGetter.java b/instrumentation/apache-dubbo-2.7/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboNetworkServerAttributesGetter.java index d9bf6e245ff8..742ca77c6636 100644 --- a/instrumentation/apache-dubbo-2.7/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboNetworkServerAttributesGetter.java +++ b/instrumentation/apache-dubbo-2.7/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboNetworkServerAttributesGetter.java @@ -17,13 +17,13 @@ final class DubboNetworkServerAttributesGetter @Override public InetSocketAddress getNetworkLocalInetSocketAddress( DubboRequest request, @Nullable Result result) { - return request.localAddress(); + return request.getLocalAddress(); } @Override @Nullable public InetSocketAddress getNetworkPeerInetSocketAddress( DubboRequest request, @Nullable Result result) { - return request.remoteAddress(); + return request.getRemoteAddress(); } } diff --git a/instrumentation/apache-dubbo-2.7/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboRequest.java b/instrumentation/apache-dubbo-2.7/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboRequest.java index 0733b744c867..727817f0bc28 100644 --- a/instrumentation/apache-dubbo-2.7/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboRequest.java +++ b/instrumentation/apache-dubbo-2.7/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboRequest.java @@ -28,13 +28,47 @@ static DubboRequest create(RpcInvocation invocation, RpcContext context) { abstract RpcInvocation invocation(); - public abstract RpcContext context(); + public abstract RpcContext getContext(); - public abstract URL url(); + /** + * @deprecated Use {@link #getContext()} instead. Will be removed in a future release. + */ + @Deprecated + public RpcContext context() { + return getContext(); + } + + public abstract URL getUrl(); + + /** + * @deprecated Use {@link #getUrl()} instead. Will be removed in a future release. + */ + @Deprecated + public URL url() { + return getUrl(); + } + + @Nullable + public abstract InetSocketAddress getRemoteAddress(); + /** + * @deprecated Use {@link #getRemoteAddress()} instead. Will be removed in a future release. + */ + @Deprecated @Nullable - public abstract InetSocketAddress remoteAddress(); + public InetSocketAddress remoteAddress() { + return getRemoteAddress(); + } @Nullable - public abstract InetSocketAddress localAddress(); + public abstract InetSocketAddress getLocalAddress(); + + /** + * @deprecated Use {@link #getLocalAddress()} instead. Will be removed in a future release. + */ + @Deprecated + @Nullable + public InetSocketAddress localAddress() { + return getLocalAddress(); + } } diff --git a/instrumentation/apache-dubbo-2.7/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/internal/DubboClientNetworkAttributesGetter.java b/instrumentation/apache-dubbo-2.7/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/internal/DubboClientNetworkAttributesGetter.java index 1077ee19c7ce..19d0ed71267b 100644 --- a/instrumentation/apache-dubbo-2.7/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/internal/DubboClientNetworkAttributesGetter.java +++ b/instrumentation/apache-dubbo-2.7/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/internal/DubboClientNetworkAttributesGetter.java @@ -22,18 +22,18 @@ public final class DubboClientNetworkAttributesGetter @Nullable @Override public String getServerAddress(DubboRequest request) { - return request.url().getHost(); + return request.getUrl().getHost(); } @Override public Integer getServerPort(DubboRequest request) { - return request.url().getPort(); + return request.getUrl().getPort(); } @Override @Nullable public InetSocketAddress getNetworkPeerInetSocketAddress( DubboRequest request, @Nullable Result response) { - return request.remoteAddress(); + return request.getRemoteAddress(); } } From 769d61f92df4f980ba025654cbdb6bac50838f18 Mon Sep 17 00:00:00 2001 From: otelbot <197425009+otelbot@users.noreply.github.com> Date: Thu, 7 May 2026 04:43:14 +0000 Subject: [PATCH 4/6] Cleanup for apache-dubbo-2.7:testing - Tighten Dubbo testing helper methods to private static where they are only used internally Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../apachedubbo/v2_7/AbstractDubboTest.java | 7 ++++--- .../v2_7/AbstractDubboTraceChainTest.java | 13 +++++++------ .../apachedubbo/v2_7/DubboTestUtil.java | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/instrumentation/apache-dubbo-2.7/testing/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/AbstractDubboTest.java b/instrumentation/apache-dubbo-2.7/testing/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/AbstractDubboTest.java index 0b88acedd1d8..8959bc3353ab 100644 --- a/instrumentation/apache-dubbo-2.7/testing/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/AbstractDubboTest.java +++ b/instrumentation/apache-dubbo-2.7/testing/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/AbstractDubboTest.java @@ -72,7 +72,7 @@ static void tearDown() { System.clearProperty("dubbo.application.qos-enable"); } - ReferenceConfig configureClient(int port) { + private static ReferenceConfig configureClient(int port) { ReferenceConfig reference = new ReferenceConfig<>(); reference.setInterface(HelloService.class); reference.setGeneric("true"); @@ -80,7 +80,7 @@ ReferenceConfig configureClient(int port) { return reference; } - ServiceConfig configureServer() { + private static ServiceConfig configureServer() { RegistryConfig registerConfig = new RegistryConfig(); registerConfig.setAddress("N/A"); ServiceConfig service = new ServiceConfig<>(); @@ -91,7 +91,8 @@ ServiceConfig configureServer() { } @SuppressWarnings({"rawtypes", "unchecked"}) - ReferenceConfig convertReference(ReferenceConfig config) { + private static ReferenceConfig convertReference( + ReferenceConfig config) { return (ReferenceConfig) config; } diff --git a/instrumentation/apache-dubbo-2.7/testing/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/AbstractDubboTraceChainTest.java b/instrumentation/apache-dubbo-2.7/testing/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/AbstractDubboTraceChainTest.java index 2eacc17c7d25..b55129d69fd1 100644 --- a/instrumentation/apache-dubbo-2.7/testing/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/AbstractDubboTraceChainTest.java +++ b/instrumentation/apache-dubbo-2.7/testing/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/AbstractDubboTraceChainTest.java @@ -70,7 +70,7 @@ static void tearDown() { protected abstract boolean hasServicePeerName(); - ReferenceConfig configureClient(int port) { + private static ReferenceConfig configureClient(int port) { ReferenceConfig reference = new ReferenceConfig<>(); reference.setInterface(HelloService.class); reference.setGeneric("true"); @@ -78,7 +78,7 @@ ReferenceConfig configureClient(int port) { return reference; } - ReferenceConfig configureLocalClient(int port) { + private static ReferenceConfig configureLocalClient(int port) { ReferenceConfig reference = new ReferenceConfig<>(); reference.setInterface(HelloService.class); reference.setGeneric("true"); @@ -86,7 +86,7 @@ ReferenceConfig configureLocalClient(int port) { return reference; } - ReferenceConfig configureMiddleClient(int port) { + private static ReferenceConfig configureMiddleClient(int port) { ReferenceConfig reference = new ReferenceConfig<>(); reference.setInterface(MiddleService.class); reference.setGeneric("true"); @@ -94,7 +94,7 @@ ReferenceConfig configureMiddleClient(int port) { return reference; } - ServiceConfig configureServer() { + private static ServiceConfig configureServer() { RegistryConfig registerConfig = new RegistryConfig(); registerConfig.setAddress("N/A"); ServiceConfig service = new ServiceConfig<>(); @@ -104,7 +104,7 @@ ServiceConfig configureServer() { return service; } - ServiceConfig configureMiddleServer( + private static ServiceConfig configureMiddleServer( ReferenceConfig referenceConfig) { RegistryConfig registerConfig = new RegistryConfig(); registerConfig.setAddress("N/A"); @@ -116,7 +116,8 @@ ServiceConfig configureMiddleServer( } @SuppressWarnings({"rawtypes", "unchecked"}) - ReferenceConfig convertReference(ReferenceConfig config) { + private static ReferenceConfig convertReference( + ReferenceConfig config) { return (ReferenceConfig) config; } diff --git a/instrumentation/apache-dubbo-2.7/testing/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboTestUtil.java b/instrumentation/apache-dubbo-2.7/testing/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboTestUtil.java index 9c4c3f425e7f..a31b14adf0d5 100644 --- a/instrumentation/apache-dubbo-2.7/testing/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboTestUtil.java +++ b/instrumentation/apache-dubbo-2.7/testing/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboTestUtil.java @@ -12,7 +12,7 @@ /** compatible with dubbo3.x and dubbo 2.7 */ class DubboTestUtil { - static Object newFrameworkModel() { + private static Object newFrameworkModel() { try { // only present in latest dep return Class.forName("org.apache.dubbo.rpc.model.FrameworkModel") From af5f21cc4e1804d109f908f5226efab4a2f66f48 Mon Sep 17 00:00:00 2001 From: otelbot <197425009+otelbot@users.noreply.github.com> Date: Thu, 7 May 2026 04:51:17 +0000 Subject: [PATCH 5/6] Cleanup for apache-elasticjob-3.0:javaagent - Move nullable ElasticJob advice scope handling into exit advice per javaagent advice pattern guidance Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../v3_0/DataflowJobExecutorInstrumentation.java | 4 +++- .../apacheelasticjob/v3_0/ElasticJobHelper.java | 8 +++----- .../v3_0/HttpJobExecutorInstrumentation.java | 4 +++- .../v3_0/ScriptJobExecutorInstrumentation.java | 4 +++- .../v3_0/SimpleJobExecutorInstrumentation.java | 4 +++- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/instrumentation/apache-elasticjob-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheelasticjob/v3_0/DataflowJobExecutorInstrumentation.java b/instrumentation/apache-elasticjob-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheelasticjob/v3_0/DataflowJobExecutorInstrumentation.java index bba6e0b1640f..78f1e092dd72 100644 --- a/instrumentation/apache-elasticjob-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheelasticjob/v3_0/DataflowJobExecutorInstrumentation.java +++ b/instrumentation/apache-elasticjob-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheelasticjob/v3_0/DataflowJobExecutorInstrumentation.java @@ -58,7 +58,9 @@ public static ElasticJobHelper.ElasticJobScope onEnter( public static void onExit( @Advice.Enter @Nullable ElasticJobHelper.ElasticJobScope scope, @Advice.Thrown @Nullable Throwable throwable) { - helper().endSpan(scope, throwable); + if (scope != null) { + helper().endSpan(scope, throwable); + } } } } diff --git a/instrumentation/apache-elasticjob-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheelasticjob/v3_0/ElasticJobHelper.java b/instrumentation/apache-elasticjob-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheelasticjob/v3_0/ElasticJobHelper.java index c7b6f3733d15..6418dce2c06f 100644 --- a/instrumentation/apache-elasticjob-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheelasticjob/v3_0/ElasticJobHelper.java +++ b/instrumentation/apache-elasticjob-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheelasticjob/v3_0/ElasticJobHelper.java @@ -31,11 +31,9 @@ public ElasticJobScope startSpan(ElasticJobProcessRequest request) { return new ElasticJobScope(request, context, context.makeCurrent()); } - public void endSpan(@Nullable ElasticJobScope scope, @Nullable Throwable throwable) { - if (scope != null) { - scope.scope.close(); - this.instrumenter.end(scope.context, scope.request, null, throwable); - } + public void endSpan(ElasticJobScope scope, @Nullable Throwable throwable) { + scope.scope.close(); + this.instrumenter.end(scope.context, scope.request, null, throwable); } public static class ElasticJobScope { diff --git a/instrumentation/apache-elasticjob-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheelasticjob/v3_0/HttpJobExecutorInstrumentation.java b/instrumentation/apache-elasticjob-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheelasticjob/v3_0/HttpJobExecutorInstrumentation.java index 7cc7b8a2327b..fc60cbf62a85 100644 --- a/instrumentation/apache-elasticjob-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheelasticjob/v3_0/HttpJobExecutorInstrumentation.java +++ b/instrumentation/apache-elasticjob-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheelasticjob/v3_0/HttpJobExecutorInstrumentation.java @@ -53,7 +53,9 @@ public static ElasticJobHelper.ElasticJobScope onEnter( public static void onExit( @Advice.Enter @Nullable ElasticJobHelper.ElasticJobScope scope, @Advice.Thrown @Nullable Throwable throwable) { - helper().endSpan(scope, throwable); + if (scope != null) { + helper().endSpan(scope, throwable); + } } } } diff --git a/instrumentation/apache-elasticjob-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheelasticjob/v3_0/ScriptJobExecutorInstrumentation.java b/instrumentation/apache-elasticjob-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheelasticjob/v3_0/ScriptJobExecutorInstrumentation.java index 64a853951389..336f2cba92d6 100644 --- a/instrumentation/apache-elasticjob-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheelasticjob/v3_0/ScriptJobExecutorInstrumentation.java +++ b/instrumentation/apache-elasticjob-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheelasticjob/v3_0/ScriptJobExecutorInstrumentation.java @@ -53,7 +53,9 @@ public static ElasticJobHelper.ElasticJobScope onEnter( public static void onExit( @Advice.Enter @Nullable ElasticJobHelper.ElasticJobScope scope, @Advice.Thrown @Nullable Throwable throwable) { - helper().endSpan(scope, throwable); + if (scope != null) { + helper().endSpan(scope, throwable); + } } } } diff --git a/instrumentation/apache-elasticjob-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheelasticjob/v3_0/SimpleJobExecutorInstrumentation.java b/instrumentation/apache-elasticjob-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheelasticjob/v3_0/SimpleJobExecutorInstrumentation.java index ea10f5529572..09b3806e6533 100644 --- a/instrumentation/apache-elasticjob-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheelasticjob/v3_0/SimpleJobExecutorInstrumentation.java +++ b/instrumentation/apache-elasticjob-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheelasticjob/v3_0/SimpleJobExecutorInstrumentation.java @@ -58,7 +58,9 @@ public static ElasticJobHelper.ElasticJobScope onEnter( public static void onExit( @Advice.Enter @Nullable ElasticJobHelper.ElasticJobScope scope, @Advice.Thrown @Nullable Throwable throwable) { - helper().endSpan(scope, throwable); + if (scope != null) { + helper().endSpan(scope, throwable); + } } } } From e42f003a83b89670307e5490928b0f52eb6c7b46 Mon Sep 17 00:00:00 2001 From: otelbot <197425009+otelbot@users.noreply.github.com> Date: Thu, 7 May 2026 07:24:48 +0000 Subject: [PATCH 6/6] Cleanup for apache-httpasyncclient-4.1:javaagent - Reuse a single response-content cleanup helper so tests close the retrieved stream once, avoiding duplicated getContent() calls and aligning with the resource-cleanup review guidance.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../v4_1/ApacheHttpAsyncClientTest.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/instrumentation/apache-httpasyncclient-4.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/v4_1/ApacheHttpAsyncClientTest.java b/instrumentation/apache-httpasyncclient-4.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/v4_1/ApacheHttpAsyncClientTest.java index 0b92ad9d113d..483d4fa40406 100644 --- a/instrumentation/apache-httpasyncclient-4.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/v4_1/ApacheHttpAsyncClientTest.java +++ b/instrumentation/apache-httpasyncclient-4.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/v4_1/ApacheHttpAsyncClientTest.java @@ -12,6 +12,7 @@ import io.opentelemetry.instrumentation.testing.junit.http.HttpClientResult; import io.opentelemetry.instrumentation.testing.junit.http.HttpClientTestOptions; import java.io.IOException; +import java.io.InputStream; import java.io.UncheckedIOException; import java.net.URI; import java.util.Map; @@ -178,27 +179,28 @@ HttpUriRequest configureRequest(HttpUriRequest request, Map head } int getResponseCode(HttpResponse response) { + closeContent(response); + return response.getStatusLine().getStatusCode(); + } + + static void closeContent(HttpResponse response) { try { - if (response.getEntity() != null && response.getEntity().getContent() != null) { - response.getEntity().getContent().close(); + if (response.getEntity() != null) { + InputStream content = response.getEntity().getContent(); + if (content != null) { + content.close(); + } } } catch (IOException e) { throw new UncheckedIOException(e); } - return response.getStatusLine().getStatusCode(); } static FutureCallback responseCallback(HttpClientResult httpClientResult) { return new FutureCallback() { @Override public void completed(HttpResponse response) { - try { - if (response.getEntity() != null && response.getEntity().getContent() != null) { - response.getEntity().getContent().close(); - } - } catch (IOException e) { - throw new UncheckedIOException(e); - } + closeContent(response); httpClientResult.complete(response.getStatusLine().getStatusCode()); }