
Plugin-based Java agent management framework supporting dynamic install/uninstall of agents and lifecycle hooks for unified monitoring and instrumentation.
If a plugin wishes to be aware of the lifecycle, it can implement the PluginActivator interface:
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;
}
Place a plugin.properties file under the plugin directory, and also place the native agent jar file.
For example:
type=traditional
name=demo-agent
version=1.0.0
agentJarPath=demo-agent.jar
Then one-java-agent will start this demo-agent.
mvn clean install bytekit firstmvn clean package -DskipTests && mvn testmvn clean package -P local -DskipTests will package and install the latest to the local ~/oneoneagent directory