@@ -57,7 +57,7 @@ public class DebuggerAgent {
5757 private static DebuggerSink sink ;
5858 private static String agentVersion ;
5959 private static JsonSnapshotSerializer snapshotSerializer ;
60- private static ClassNameFilter classNameFilter ;
60+ private static volatile ClassNameFilter classNameFilter ;
6161 private static SymDBEnablement symDBEnablement ;
6262 private static volatile ConfigurationUpdater configurationUpdater ;
6363 private static volatile DefaultExceptionDebugger exceptionDebugger ;
@@ -83,7 +83,6 @@ public static synchronized void run(Instrumentation inst, SharedCommunicationObj
8383 config , diagnosticEndpoint , ddAgentFeaturesDiscovery .supportsDebuggerDiagnostics ());
8484 DebuggerSink debuggerSink = createDebuggerSink (config , probeStatusSink );
8585 debuggerSink .start ();
86- classNameFilter = new ClassNameFiltering (config );
8786 configurationUpdater =
8887 new ConfigurationUpdater (
8988 instrumentation ,
@@ -101,7 +100,6 @@ public static synchronized void run(Instrumentation inst, SharedCommunicationObj
101100 snapshotSerializer = new JsonSnapshotSerializer ();
102101 DebuggerContext .initValueSerializer (snapshotSerializer );
103102 DebuggerContext .initTracer (new DebuggerTracer (debuggerSink .getProbeStatusSink ()));
104- DebuggerContext .initClassNameFilter (classNameFilter );
105103 if (config .isDebuggerExceptionEnabled ()) {
106104 startExceptionReplay ();
107105 }
@@ -128,6 +126,12 @@ public static synchronized void run(Instrumentation inst, SharedCommunicationObj
128126 TracerFlare .addReporter (DebuggerAgent ::addReportToFlare );
129127 }
130128
129+ private static void initClassNameFilter () {
130+ if (classNameFilter == null ) {
131+ classNameFilter = new ClassNameFiltering (Config .get ());
132+ }
133+ }
134+
131135 public static void startDynamicInstrumentation () {
132136 if (!dynamicInstrumentationEnabled .compareAndSet (false , true )) {
133137 return ;
@@ -143,6 +147,7 @@ public static void startDynamicInstrumentation() {
143147 }
144148 if (configurationPoller != null ) {
145149 if (config .isSymbolDatabaseEnabled ()) {
150+ initClassNameFilter ();
146151 SymbolAggregator symbolAggregator =
147152 new SymbolAggregator (
148153 classNameFilter , sink .getSymbolSink (), config .getSymbolDatabaseFlushThreshold ());
@@ -179,6 +184,7 @@ public static void startExceptionReplay() {
179184 return ;
180185 }
181186 LOGGER .info ("Starting Exception Replay" );
187+ initClassNameFilter ();
182188 Config config = Config .get ();
183189 exceptionDebugger =
184190 new DefaultExceptionDebugger (
@@ -207,6 +213,8 @@ public static void startCodeOriginForSpans() {
207213 return ;
208214 }
209215 LOGGER .info ("Starting Code Origin for spans" );
216+ initClassNameFilter ();
217+ DebuggerContext .initClassNameFilter (classNameFilter );
210218 DebuggerContext .initCodeOrigin (
211219 new DefaultCodeOriginRecorder (Config .get (), configurationUpdater ));
212220 }
0 commit comments