From 2b5c4f52d1e83e7989baa9887e1fbbf954918906 Mon Sep 17 00:00:00 2001 From: Lauri Tulmin Date: Tue, 5 Nov 2024 14:08:16 +0200 Subject: [PATCH] Run class load listener only once (#12565) --- .../java/io/opentelemetry/javaagent/tooling/AgentInstaller.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AgentInstaller.java b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AgentInstaller.java index f8cfe6eb1ca8..8cf043d0e4d3 100644 --- a/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AgentInstaller.java +++ b/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AgentInstaller.java @@ -137,7 +137,6 @@ private static void installBytebuddyAgent( .with(new RedefinitionDiscoveryStrategy()) .with(AgentBuilder.DescriptionStrategy.Default.POOL_ONLY) .with(AgentTooling.poolStrategy()) - .with(new ClassLoadListener()) .with(AgentTooling.transformListener()) .with(AgentTooling.locationStrategy()); if (JavaModule.isSupported()) { @@ -172,6 +171,7 @@ private static void installBytebuddyAgent( agentListener.beforeAgent(autoConfiguredSdk); } + agentBuilder = agentBuilder.with(new ClassLoadListener()); agentBuilder = configureIgnoredTypes(sdkConfig, extensionClassLoader, agentBuilder); int numberOfLoadedExtensions = 0;