未验证 提交 d12d3f20 编写于 作者: L libinglong 提交者: GitHub

add redefine listener (#6309)

上级 d4ea9975
......@@ -9,6 +9,8 @@ Release Notes.
#### Java Agent
* Remove invalid mysql configuration in agent.config.
* Add net.bytebuddy.agent.builder.AgentBuilder.RedefinitionStrategy.Listener
to show detail message when redifine errors occur
#### OAP-Backend
......
......@@ -19,7 +19,9 @@
package org.apache.skywalking.apm.agent;
import java.lang.instrument.Instrumentation;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import net.bytebuddy.ByteBuddy;
import net.bytebuddy.agent.builder.AgentBuilder;
......@@ -123,6 +125,7 @@ public class SkyWalkingAgent {
agentBuilder.type(pluginFinder.buildMatch())
.transform(new Transformer(pluginFinder))
.with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION)
.with(new RedefinitionListener())
.with(new Listener())
.installOn(instrumentation);
......@@ -215,4 +218,23 @@ public class SkyWalkingAgent {
public void onComplete(String typeName, ClassLoader classLoader, JavaModule module, boolean loaded) {
}
}
private static class RedefinitionListener implements AgentBuilder.RedefinitionStrategy.Listener {
@Override
public void onBatch(int index, List<Class<?>> batch, List<Class<?>> types) {
/* do nothing */
}
@Override
public Iterable<? extends List<Class<?>>> onError(int index, List<Class<?>> batch, Throwable throwable, List<Class<?>> types) {
LOGGER.error(throwable, "index={}, batch={}, types={}", index, batch, types);
return Collections.emptyList();
}
@Override
public void onComplete(int amount, List<Class<?>> types, Map<List<Class<?>>, Throwable> failures) {
/* do nothing */
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册