add redefine listener (#6309)
This commit is contained in:
parent
d4ea997523
commit
d12d3f201a
|
|
@ -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 */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue