|
16 | 16 | */ |
17 | 17 | package com.datadoghq.agent; |
18 | 18 |
|
| 19 | +import static com.datadoghq.agent.utils.ClassLoaderNameMatcher.classLoaderWithName; |
| 20 | +import static com.datadoghq.agent.utils.ClassLoaderNameMatcher.isReflectionClassLoader; |
| 21 | +import static net.bytebuddy.matcher.ElementMatchers.any; |
| 22 | +import static net.bytebuddy.matcher.ElementMatchers.isBootstrapClassLoader; |
| 23 | +import static net.bytebuddy.matcher.ElementMatchers.nameContains; |
19 | 24 | import static net.bytebuddy.matcher.ElementMatchers.nameStartsWith; |
20 | 25 |
|
21 | 26 | import com.datadoghq.agent.instrumentation.Instrumenter; |
@@ -60,13 +65,29 @@ protected static String addManager(String agentArgs) { |
60 | 65 | } |
61 | 66 |
|
62 | 67 | public static void addByteBuddy(final Instrumentation inst) { |
63 | | - |
64 | 68 | AgentBuilder agentBuilder = |
65 | 69 | new AgentBuilder.Default() |
66 | 70 | .disableClassFormatChanges() |
67 | 71 | .with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION) |
68 | 72 | .with(new Listener()) |
69 | | - .ignore(nameStartsWith("com.datadoghq.agent.integration")); |
| 73 | + .ignore(nameStartsWith("com.datadoghq.agent.integration")) |
| 74 | + .or(nameStartsWith("java.")) |
| 75 | + .or(nameStartsWith("com.sun.")) |
| 76 | + .or(nameStartsWith("sun.")) |
| 77 | + .or(nameStartsWith("jdk.")) |
| 78 | + .or(nameStartsWith("org.aspectj.")) |
| 79 | + .or(nameStartsWith("org.groovy.")) |
| 80 | + .or(nameStartsWith("com.p6spy.")) |
| 81 | + .or(nameStartsWith("org.slf4j.")) |
| 82 | + .or(nameContains("javassist")) |
| 83 | + .or(nameContains(".asm.")) |
| 84 | + .ignore( |
| 85 | + any(), |
| 86 | + isBootstrapClassLoader() |
| 87 | + .or(isReflectionClassLoader()) |
| 88 | + .or( |
| 89 | + classLoaderWithName( |
| 90 | + "org.codehaus.groovy.runtime.callsite.CallSiteClassLoader"))); |
70 | 91 |
|
71 | 92 | for (final Instrumenter instrumenter : ServiceLoader.load(Instrumenter.class)) { |
72 | 93 | agentBuilder = instrumenter.instrument(agentBuilder); |
@@ -95,7 +116,7 @@ public void onTransformation( |
95 | 116 | final JavaModule module, |
96 | 117 | final boolean loaded, |
97 | 118 | final DynamicType dynamicType) { |
98 | | - log.debug("Transformed {0}", typeDescription); |
| 119 | + log.debug("Transformed {}", typeDescription); |
99 | 120 | } |
100 | 121 |
|
101 | 122 | @Override |
|
0 commit comments