Skip to content

Commit

Permalink
Move Memoizer.resetState() to after the test agent has been (re)insta…
Browse files Browse the repository at this point in the history
…lled but before the tests have run
  • Loading branch information
mcculls committed May 10, 2023
1 parent 88a4f4a commit cd89962
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
public final class MemoizedMatchers implements HierarchyMatchers.Supplier {
public static void registerAsSupplier() {
HierarchyMatchers.registerIfAbsent(new MemoizedMatchers());
Memoizer.resetState();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit cd89962

Please sign in to comment.