在启动一个挂载pinpoint的springboot项目的时候,界面上显示成了jboss的图标,因此今天研究了一下这个数据是怎么来的。spring
咱们知道不一样图标和服务类型有关,服务不一样,图标就不一样,这在代码里面使用一个ServiceType属性来描述。springboot
Sending AgentInfo TAgentInfo.... hostname:izwz98jc3nwxdjxg1yfd1hz, ip:172.xx.xx, ports:, agentId:testboot_agentId, applicationName:testboot_45, serviceType:1210, pid:28277, agentVersion:1.8.0, AgentInfo sent.
@AgentId String agentId, @ApplicationName String applicationName, @Container boolean isContainer, @AgentStartTime long agentStartTime, @ApplicationServerType ServiceType serverType
// service type this.applicationServerType = readString("profiler.applicationservertype", null);
没错,就是UNDEFINED。没定义确定取不到值呀。app
此时,pinpoint会获取全部已经注册的插件,调用他们的detect方法。若是校验经过,则直接返回插件中配置的serviceType。maven
boolean detect(ConditionProvider provider);
ServiceType STAND_ALONE = of(1000, "STAND_ALONE", RECORD_STATISTICS);
借用下群友图片,咱们知道若是不配置,默认会去检测MAIN-CLASS的值有没有和pinpoint.config中的配置对应上。
ide
一旦检测到,就返回对应插件的serverType,也就是SpringBoot。this
profiler.jboss.traceEjb=false profiler.applicationservertype=JBOSS
欢迎来公众号【侠梦的开发笔记】 一块儿交流进步插件