Apply matcher if debug logging enabled to avoid confusing log output.
Otherwise it was "Skipping" every unrelated class.
This commit is contained in:
parent
39e577ad97
commit
eb8de0d3ab
|
@ -103,6 +103,8 @@ public abstract class AbstractExecutorInstrumentation extends Instrumenter.Defau
|
||||||
@Override
|
@Override
|
||||||
public ElementMatcher<TypeDescription> typeMatcher() {
|
public ElementMatcher<TypeDescription> typeMatcher() {
|
||||||
ElementMatcher.Junction<TypeDescription> matcher = not(isInterface());
|
ElementMatcher.Junction<TypeDescription> matcher = not(isInterface());
|
||||||
|
final ElementMatcher.Junction<TypeDescription> hasExecutorInterfaceMatcher =
|
||||||
|
hasInterface(named(Executor.class.getName()));
|
||||||
if (!TRACE_ALL_EXECUTORS) {
|
if (!TRACE_ALL_EXECUTORS) {
|
||||||
matcher =
|
matcher =
|
||||||
matcher.and(
|
matcher.and(
|
||||||
|
@ -121,15 +123,16 @@ public abstract class AbstractExecutorInstrumentation extends Instrumenter.Defau
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!whitelisted) {
|
if (!whitelisted
|
||||||
|
&& log.isDebugEnabled()
|
||||||
|
&& hasExecutorInterfaceMatcher.matches(target)) {
|
||||||
log.debug("Skipping executor instrumentation for {}", target.getName());
|
log.debug("Skipping executor instrumentation for {}", target.getName());
|
||||||
}
|
}
|
||||||
return whitelisted;
|
return whitelisted;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return matcher.and(
|
return matcher.and(hasExecutorInterfaceMatcher); // Apply expensive matcher last.
|
||||||
hasInterface(named(Executor.class.getName()))); // Apply expensive matcher last.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -78,19 +78,23 @@ public final class FutureInstrumentation extends Instrumenter.Default {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ElementMatcher<TypeDescription> typeMatcher() {
|
public ElementMatcher<TypeDescription> typeMatcher() {
|
||||||
|
final ElementMatcher.Junction<TypeDescription> hasFutureInterfaceMatcher =
|
||||||
|
hasInterface(named(Future.class.getName()));
|
||||||
return not(isInterface())
|
return not(isInterface())
|
||||||
.and(
|
.and(
|
||||||
new ElementMatcher<TypeDescription>() {
|
new ElementMatcher<TypeDescription>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(final TypeDescription target) {
|
public boolean matches(final TypeDescription target) {
|
||||||
final boolean whitelisted = WHITELISTED_FUTURES.contains(target.getName());
|
final boolean whitelisted = WHITELISTED_FUTURES.contains(target.getName());
|
||||||
if (!whitelisted) {
|
if (!whitelisted
|
||||||
|
&& log.isDebugEnabled()
|
||||||
|
&& hasFutureInterfaceMatcher.matches(target)) {
|
||||||
log.debug("Skipping future instrumentation for {}", target.getName());
|
log.debug("Skipping future instrumentation for {}", target.getName());
|
||||||
}
|
}
|
||||||
return whitelisted;
|
return whitelisted;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.and(hasInterface(named(Future.class.getName()))); // Apply expensive matcher last.
|
.and(hasFutureInterfaceMatcher); // Apply expensive matcher last.
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue