|
3 | 3 | import static datadog.trace.agent.tooling.bytebuddy.matcher.HierarchyMatchers.extendsClass; |
4 | 4 | import static datadog.trace.agent.tooling.bytebuddy.matcher.NameMatchers.named; |
5 | 5 | import static datadog.trace.agent.tooling.bytebuddy.matcher.NameMatchers.namedOneOf; |
| 6 | +import static datadog.trace.bootstrap.instrumentation.java.concurrent.ExcludeFilter.ExcludeType.EXECUTOR; |
6 | 7 | import static datadog.trace.bootstrap.instrumentation.java.concurrent.ExcludeFilter.ExcludeType.RUNNABLE; |
7 | 8 | import static datadog.trace.bootstrap.instrumentation.java.concurrent.ExcludeFilter.ExcludeType.RUNNABLE_FUTURE; |
8 | 9 | import static datadog.trace.bootstrap.instrumentation.java.concurrent.ExcludeFilter.exclude; |
|
30 | 31 | import java.util.Collection; |
31 | 32 | import java.util.Collections; |
32 | 33 | import java.util.HashMap; |
| 34 | +import java.util.List; |
33 | 35 | import java.util.Map; |
34 | 36 | import java.util.Queue; |
35 | 37 | import java.util.concurrent.RunnableFuture; |
@@ -129,11 +131,17 @@ public void methodAdvice(MethodTransformer transformer) { |
129 | 131 |
|
130 | 132 | @Override |
131 | 133 | public Map<ExcludeFilter.ExcludeType, ? extends Collection<String>> excludedClasses() { |
132 | | - return Collections.singletonMap( |
| 134 | + Map<ExcludeFilter.ExcludeType, List<String>> map = new HashMap<>(2); |
| 135 | + map.put( |
133 | 136 | RUNNABLE, |
134 | 137 | Arrays.asList( |
135 | 138 | "datadog.trace.bootstrap.instrumentation.java.concurrent.Wrapper", |
136 | 139 | "datadog.trace.bootstrap.instrumentation.java.concurrent.ComparableRunnable")); |
| 140 | + map.put( |
| 141 | + EXECUTOR, |
| 142 | + Collections.singletonList("org.apache.mina.filter.executor.OrderedThreadPoolExecutor")); |
| 143 | + |
| 144 | + return Collections.unmodifiableMap(map); |
137 | 145 | } |
138 | 146 |
|
139 | 147 | public static final class Init { |
@@ -162,22 +170,24 @@ public static void capture( |
162 | 170 | // queue time needs to be handled separately because there are RunnableFutures which are |
163 | 171 | // excluded as |
164 | 172 | // Runnables but it is not until now that they will be put on the executor's queue |
165 | | - if (!exclude(RUNNABLE, task)) { |
166 | | - Queue<?> queue = tpe.getQueue(); |
167 | | - QueueTimerHelper.startQueuingTimer( |
168 | | - InstrumentationContext.get(Runnable.class, State.class), |
169 | | - tpe.getClass(), |
170 | | - queue.getClass(), |
171 | | - queue.size(), |
172 | | - task); |
173 | | - } else if (!exclude(RUNNABLE_FUTURE, task) && task instanceof RunnableFuture) { |
174 | | - Queue<?> queue = tpe.getQueue(); |
175 | | - QueueTimerHelper.startQueuingTimer( |
176 | | - InstrumentationContext.get(RunnableFuture.class, State.class), |
177 | | - tpe.getClass(), |
178 | | - queue.getClass(), |
179 | | - queue.size(), |
180 | | - (RunnableFuture<?>) task); |
| 173 | + if (!exclude(EXECUTOR, tpe)) { |
| 174 | + if (!exclude(RUNNABLE, task)) { |
| 175 | + Queue<?> queue = tpe.getQueue(); |
| 176 | + QueueTimerHelper.startQueuingTimer( |
| 177 | + InstrumentationContext.get(Runnable.class, State.class), |
| 178 | + tpe.getClass(), |
| 179 | + queue.getClass(), |
| 180 | + queue.size(), |
| 181 | + task); |
| 182 | + } else if (!exclude(RUNNABLE_FUTURE, task) && task instanceof RunnableFuture) { |
| 183 | + Queue<?> queue = tpe.getQueue(); |
| 184 | + QueueTimerHelper.startQueuingTimer( |
| 185 | + InstrumentationContext.get(RunnableFuture.class, State.class), |
| 186 | + tpe.getClass(), |
| 187 | + queue.getClass(), |
| 188 | + queue.size(), |
| 189 | + (RunnableFuture<?>) task); |
| 190 | + } |
181 | 191 | } |
182 | 192 | } |
183 | 193 | } |
|
0 commit comments