
Framework de gerenciamento de agentes Java baseado em plugins que suporta instalação/desinstalação dinâmica de agentes e hooks de ciclo de vida para monitoramento e instrumentação unificados.
Se um plugin quiser perceber o ciclo de vida, ele pode implementar a interface PluginActivator:
public interface PluginActivator {
// 让插件本身判断是否要启动
boolean enabled(PluginContext context);
public void init(PluginContext context) throws Exception;
/**
* Before calling this method, the {@link PluginState} is
* {@link PluginState#STARTING}, after calling, the {@link PluginState} is
* {@link PluginState#ACTIVE}
*
* @param context
*/
public void start(PluginContext context) throws Exception;
/**
* Before calling this method, the {@link PluginState} is
* {@link PluginState#STOPPING}, after calling, the {@link PluginState} is
* {@link PluginState#RESOLVED}
*
* @param context
*/
public void stop(PluginContext context) throws Exception;
}
No diretório de plugins, coloque um arquivo plugin.properties e também o arquivo jar do agente original.
Por exemplo:
type=traditional
name=demo-agent
version=1.0.0
agentJarPath=demo-agent.jar
Então o one-java-agent iniciará este demo-agent.
mvn clean install no bytekit primeiro.mvn clean package -DskipTests && mvn testmvn clean package -P local -DskipTests fará o empacotamento e instalará a versão mais recente localmente no diretório ~/oneoneagent.