Pinpoint是一款全链路分析工具,提供了无侵入式的调用链监控、方法执行详情查看、应用状态信息监控等功能。目前公司通过开发pinpoint来满足链路分析、中间件增强、环境隔离等需求,图1为pinpoint的基本结构。

总的来说,pinpoint-agent通过在各种中间件方法上埋点来采集信息,数据上报到pinpoint-collector,由pinpoint-collector接收并持久化到hbase,pinpoint-web负责渲染,在pinpoint-collector和pinpoint-web之间还会维护一条长连接,负责传输实时数据。
本文主要分析pinpoint-agent的启动过程,pinpoint的版本为1.7.2,与目前最新版有一定差异(当前最新版为1.9.0)。
Pinpoint Agent启动过程
- 启动入口为PinpointBootStrap.premain方法
- 设置启动状态,解析启动参数,查找核心jar文件,使用BootstrapClassLoader加载核心jar中的类
- 实例化PinpointStarter,调用start方法
public static void premain(String agentArgs, Instrumentation instrumentation) {
if (agentArgs == null) {
agentArgs = "";
}
logger.info(ProductInfo.NAME + " agentArgs:" + agentArgs);
final boolean success = STATE.start();
if (!success) {
logger.warn("pinpoint-bootstrap already started. skipping agent loading.");
return;
}
Map<String, String> agentArgsMap = argsToMap(agentArgs);
final ClassPathResolver classPathResolver = new

本文详述了Pinpoint Agent的启动过程,从PinpointBootStrap.premain方法开始,包括设置启动状态、解析参数、加载插件、实例化ServiceTypeRegistry和AnnotationKeyRegistry,以及启动监控线程等步骤。通过对1.7.2版本的分析,展示了其相对简洁的启动逻辑。

2250

被折叠的 条评论
为什么被折叠?



