From 3f5e555f925652ac5feaac9fa9def39305d76661 Mon Sep 17 00:00:00 2001 From: Lauri Tulmin Date: Thu, 20 Mar 2025 13:32:49 +0200 Subject: [PATCH] Remove debug logging for apache http client 5.0 --- .../javaagent/build.gradle.kts | 1 - ...ApacheHttpClientInstrumentationModule.java | 10 ----- .../v5_0/IoReactorDebugInstrumentation.java | 41 ------------------- 3 files changed, 52 deletions(-) delete mode 100644 instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/IoReactorDebugInstrumentation.java diff --git a/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/build.gradle.kts b/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/build.gradle.kts index 0a2a3fe973f0..86a92a3636b2 100644 --- a/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/build.gradle.kts +++ b/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/build.gradle.kts @@ -19,6 +19,5 @@ dependencies { tasks { withType().configureEach { systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean) - systemProperty("otel.instrumentation.apache-httpclient-5.debug", "true") } } diff --git a/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpClientInstrumentationModule.java b/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpClientInstrumentationModule.java index 83ee1c681486..0e478a395f1c 100644 --- a/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpClientInstrumentationModule.java +++ b/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpClientInstrumentationModule.java @@ -6,7 +6,6 @@ package io.opentelemetry.javaagent.instrumentation.apachehttpclient.v5_0; import com.google.auto.service.AutoService; -import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule; import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; import java.util.Arrays; @@ -21,15 +20,6 @@ public ApacheHttpClientInstrumentationModule() { @Override public List typeInstrumentations() { - boolean debug = - AgentInstrumentationConfig.get() - .getBoolean("otel.instrumentation.apache-httpclient-5.debug", false); - if (debug) { - return Arrays.asList( - new ApacheHttpClientInstrumentation(), - new ApacheHttpAsyncClientInstrumentation(), - new IoReactorDebugInstrumentation()); - } return Arrays.asList( new ApacheHttpClientInstrumentation(), new ApacheHttpAsyncClientInstrumentation()); } diff --git a/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/IoReactorDebugInstrumentation.java b/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/IoReactorDebugInstrumentation.java deleted file mode 100644 index 53a9f9c01c87..000000000000 --- a/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/IoReactorDebugInstrumentation.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.javaagent.instrumentation.apachehttpclient.v5_0; - -import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.implementsInterface; -import static net.bytebuddy.matcher.ElementMatchers.named; -import static net.bytebuddy.matcher.ElementMatchers.namedOneOf; - -import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; -import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; -import net.bytebuddy.asm.Advice; -import net.bytebuddy.description.type.TypeDescription; -import net.bytebuddy.matcher.ElementMatcher; - -public class IoReactorDebugInstrumentation implements TypeInstrumentation { - - @Override - public ElementMatcher typeMatcher() { - return implementsInterface(named("org.apache.hc.core5.reactor.IOReactor")); - } - - @Override - public void transform(TypeTransformer transformer) { - transformer.applyAdviceToMethod( - namedOneOf("close", "initiateShutdown"), this.getClass().getName() + "$CloseAdvice"); - } - - @SuppressWarnings("unused") - public static class CloseAdvice { - - @SuppressWarnings("SystemOut") - @Advice.OnMethodEnter(suppress = Throwable.class) - public static void methodEnter(@Advice.This Object instance) { - System.err.println("closing i/o reactor " + instance); - new Exception().printStackTrace(); - } - } -}