|
13 | 13 |
|
14 | 14 | public class TestApplicationHelper { |
15 | 15 | // instrumentation is done by main thread |
16 | | - private static final String INSTRUMENTATION_DONE_MAIN_THREAD = |
17 | | - "[main] DEBUG com.datadog.debugger.agent.DebuggerTransformer - Generating bytecode for class: %s"; |
18 | | - private static final String INSTRUMENTATION_DONE_BCKG_THREAD = |
19 | | - "[dd-remote-config] DEBUG com.datadog.debugger.agent.DebuggerTransformer - Generating bytecode for class: %s"; |
20 | | - private static final String INSTRUMENTATION_DONE_TASK_THREAD = |
21 | | - "[dd-task-scheduler] DEBUG com.datadog.debugger.agent.DebuggerTransformer - Generating bytecode for class: %s"; |
| 16 | + private static final String INSTRUMENTATION_DONE = |
| 17 | + "[%s] DEBUG com.datadog.debugger.agent.DebuggerTransformer - Generating bytecode for class: %s"; |
| 18 | + private static final String THREAD_MAIN = "main"; |
| 19 | + private static final String THREAD_REMOTE_CONFIG = "dd-remote-config"; |
| 20 | + private static final String THREAD_SCHEDULER = "dd-task-scheduler"; |
| 21 | + private static final String THREAD_STARTUP = "dd-agent-startup-datadog-tracer"; |
| 22 | + private static final String[] THREAD_NAMES = |
| 23 | + new String[] {THREAD_MAIN, THREAD_REMOTE_CONFIG, THREAD_SCHEDULER, THREAD_STARTUP}; |
22 | 24 | private static final String RENTRANSFORMATION_CLASS = |
23 | 25 | "[dd-remote-config] DEBUG com.datadog.debugger.agent.ConfigurationUpdater - Re-transforming class: %s"; |
24 | 26 | private static final String RETRANSFORMATION_DONE = |
@@ -52,17 +54,16 @@ public static String waitForInstrumentation(String logFileName, String className |
52 | 54 | fromLine != null ? line -> line.contains(fromLine) : null, |
53 | 55 | line -> { |
54 | 56 | // when instrumentation is done by main thread, we are good to go |
55 | | - if (line.contains(String.format(INSTRUMENTATION_DONE_MAIN_THREAD, className))) { |
| 57 | + if (line.contains(String.format(INSTRUMENTATION_DONE, THREAD_MAIN, className))) { |
56 | 58 | return true; |
57 | 59 | } |
58 | 60 | if (!generatingByteCode.get()) { |
59 | 61 | // instrumentation is done by background thread, need to wait for end of |
60 | 62 | // re-transformation |
61 | | - if (line.contains(String.format(INSTRUMENTATION_DONE_BCKG_THREAD, className))) { |
62 | | - generatingByteCode.set(true); |
63 | | - } |
64 | | - if (line.contains(String.format(INSTRUMENTATION_DONE_TASK_THREAD, className))) { |
65 | | - generatingByteCode.set(true); |
| 63 | + for (String threadName : THREAD_NAMES) { |
| 64 | + if (line.contains(String.format(INSTRUMENTATION_DONE, threadName, className))) { |
| 65 | + generatingByteCode.set(true); |
| 66 | + } |
66 | 67 | } |
67 | 68 | } else { |
68 | 69 | return line.contains(RETRANSFORMATION_DONE); |
|
0 commit comments