From 9670fbf5553f23fb1e0aafd9dee5ba80d5d76368 Mon Sep 17 00:00:00 2001 From: Stuart McCulloch Date: Wed, 21 May 2025 18:41:42 +0200 Subject: [PATCH] Ensure ClassloadingInstrumentation is always applied even with DD_TRACE_ENABLED=false This avoids potential class-loading delegation issues when using other products in dd-java-agent --- .../classloading/ClassloadingInstrumentation.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dd-java-agent/instrumentation/classloading/src/main/java/datadog/trace/instrumentation/classloading/ClassloadingInstrumentation.java b/dd-java-agent/instrumentation/classloading/src/main/java/datadog/trace/instrumentation/classloading/ClassloadingInstrumentation.java index d9073395147..15e0e626573 100644 --- a/dd-java-agent/instrumentation/classloading/src/main/java/datadog/trace/instrumentation/classloading/ClassloadingInstrumentation.java +++ b/dd-java-agent/instrumentation/classloading/src/main/java/datadog/trace/instrumentation/classloading/ClassloadingInstrumentation.java @@ -16,6 +16,7 @@ import datadog.trace.agent.tooling.InstrumenterModule; import datadog.trace.bootstrap.CallDepthThreadLocalMap; import datadog.trace.bootstrap.Constants; +import java.util.Set; import net.bytebuddy.asm.Advice; import net.bytebuddy.description.type.TypeDescription; import net.bytebuddy.matcher.ElementMatcher; @@ -31,7 +32,7 @@ * for the classes that we have put in the bootstrap class loader. */ @AutoService(InstrumenterModule.class) -public final class ClassloadingInstrumentation extends InstrumenterModule.Tracing +public final class ClassloadingInstrumentation extends InstrumenterModule implements Instrumenter.ForBootstrap, Instrumenter.ForTypeHierarchy, Instrumenter.HasMethodAdvice { @@ -39,6 +40,11 @@ public ClassloadingInstrumentation() { super("classloading"); } + @Override + public boolean isApplicable(Set enabledSystems) { + return true; + } + @Override protected boolean defaultEnabled() { return true;