diff --git a/dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/bytebuddy/memoize/MemoizedMatchers.java b/dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/bytebuddy/memoize/MemoizedMatchers.java index a2d1f284073e..3ad1f1a8c97f 100644 --- a/dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/bytebuddy/memoize/MemoizedMatchers.java +++ b/dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/bytebuddy/memoize/MemoizedMatchers.java @@ -24,7 +24,6 @@ public final class MemoizedMatchers implements HierarchyMatchers.Supplier { public static void registerAsSupplier() { HierarchyMatchers.registerIfAbsent(new MemoizedMatchers()); - Memoizer.resetState(); } @Override diff --git a/dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/AgentTestRunner.groovy b/dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/AgentTestRunner.groovy index 5445e8a32260..0e0139f58fb9 100644 --- a/dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/AgentTestRunner.groovy +++ b/dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/AgentTestRunner.groovy @@ -13,9 +13,11 @@ import datadog.trace.agent.tooling.AgentInstaller import datadog.trace.agent.tooling.Instrumenter import datadog.trace.agent.tooling.TracerInstaller import datadog.trace.agent.tooling.bytebuddy.matcher.GlobalIgnores +import datadog.trace.agent.tooling.bytebuddy.memoize.Memoizer import datadog.trace.api.Config import datadog.trace.api.DDSpanId import datadog.trace.api.IdGenerationStrategy +import datadog.trace.api.InstrumenterConfig import datadog.trace.api.StatsDClient import datadog.trace.api.WellKnownTags import datadog.trace.api.config.TracerConfig @@ -212,6 +214,10 @@ abstract class AgentTestRunner extends DDSpecification implements AgentBuilder.L .hasNext(): "No instrumentation found" activeTransformer = AgentInstaller.installBytebuddyAgent( INSTRUMENTATION, true, AgentInstaller.getEnabledSystems(), this) + + if (InstrumenterConfig.get().isResolverMemoizingEnabled()) { + Memoizer.resetState() + } } /** Override to set config before the agent is installed */