libinglong commented on a change in pull request #6330: URL: https://github.com/apache/skywalking/pull/6330#discussion_r570933857
########## File path: apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/plugin/match/ProtectiveShieldMatcher.java ########## @@ -44,7 +44,11 @@ public ProtectiveShieldMatcher(ElementMatcher<? super T> matcher) { @Override public boolean matches(T target) { try { - return this.matcher.matches(target); + boolean match = this.matcher.matches(target); + if (LOGGER.isDebugEnable()) { + LOGGER.debug("type={}, match={}", target, match); + } + return match; Review comment: We can only log when match is false. In some scene, the result of match is not as we think. Let's see the paragraph in https://github.com/apache/skywalking-website/pull/209/files# > Now we should decide how to do this. You can use the RunnableWrapper in the maven artifact org.apache.skywalking:apm-toolkit-trace to wrap the param, but you will face another problem. This RunnableWrapper has a plugin whose active condition is checking if there is @TraceCrossThread. Byte buddy in skywalking will use net.bytebuddy.pool.TypePool.Default.WithLazyResolution.LazyTypeDescription to find the annotations of a class. The LazyTypeDescription finds annotations by using a URLClassLoader with no urls if the classloader is null(bootstrap classloader). So it can not find the @TraceCrossThread class unless you change the LocationStrategy of skywalking java agent builder. When I inject the RunnableWrapper in the maven artifact org.apache.skywalking:apm-toolkit-trace into the bootstrap classloader. It can not be enhanced properly because the byte buddy can not find it's @TraceCrossThread annotation. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org