linkagent源码分析

探针LinkAgent快来了解一下!: https://news.shulie.io/?p=3966

管理后台交互接口

上报应用信息

http接口: /api/application/center/app/info

agent心跳

探针列表状态

注册到zookeeper,path=/config/log/pradar/status/{appName}/{agentId}

数据:

{"agentId":"10.0.44.46-580","simulatorVersion":"5.6.0.7","address":"10.0.44.46","errorCode":"","pid":"580","agentLanguage":"JAVA","userId":"1","agentStatus":"INSTALLED","jvmArgsCheck":"{\"status\":\"true\"}","errorMsg":"","jdk":"1.8.0_111","jvmArgs":"[\"-XX:MetaspaceSize=356M\",\"-XX:MaxMetaspaceSize=356M\",\"-Xbootclasspath/a:D:\\\\simulator-agent\\\\lib\\\\tools.jar\",\"-javaagent:D:\\\\simulator-agent\\\\bootstrap\\\\transmittable-thread-local-2.12.1.jar\",\"-javaagent:D:\\\\simulator-agent\\\\simulator-launcher-instrument.jar\",\"-Dsimulator.delay=10\",\"-Dsimulator.agent.skip.jvmArgsCheck=true\",\"-Dpradar.project.name=seq-server\",\"-Djdk.attach.allowAttachSelf=true\",\"-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005\",\"-XX:TieredStopAtLevel=1\",\"-Xverify:none\",\"-Dspring.output.ansi.enabled=always\",\"-Dcom.sun.management.jmxremote\",\"-Dspring.jmx.enabled=true\",\"-Dspring.liveBeansView.mbeanDomain\",\"-Dspring.application.admin.enabled=true\",\"-javaagent:D:\\\\Program Files\\\\JetBrains\\\\IntelliJ IDEA 2020.1\\\\lib\\\\idea_rt.jar=54194:D:\\\\Program Files\\\\JetBrains\\\\IntelliJ IDEA 2020.1\\\\bin\",\"-Dfile.encoding=UTF-8\"]","envCode":"test","host":"test.nacos","name":"580@fund-0-44-46","agentVersion":"5.3.4.1","tenantAppKey":"default"}

其他接口

URL说明
/api/smon/app/addAppInfo启动上报agent、应用、机器等信息(未使用)
/api/smon/app/updateAppInfo更新信息(未使用)


/api/application/center/app/info上报应用信息
/api/agent/application/node/probe/operate获取探针安装命令(取消远程安装,后续去掉)
/api/agent/application/node/probe/operateResult完成探针安装确认(取消远程安装,后续去掉)
/api/agent/heartbeat心跳(远程安装相关,后续去掉)
/agent/push/application/middleware   上传中间件信息
/api/agent/api/register上传入口规则
/api/application/agent/access/status上报探针接入状态
/api/confcenter/interface/query/needUpload 判断是否需要上传应用信息(dubbo+job数据,后续去掉)
/api/confcenter/interface/add/interfaceData上传应用信息(dubbo+job数据,后续去掉)
/api/confcenter/applicationmnt/update/applicationAgent更新探针版本信息


/api/application/center/app/switch/agent查询全局压测开关状态
/api/global/switch/whitelist查询全局白名单开关状态
/api/application/plugins/config/queryByAppName获取插件配置(目前只有redis过期时间)
/api/remote/call/configs/pull查询压测白名单(远程调用)、黑名单(redis非影子key)信息
/api/link/ds/configs/pull获取影子库/表配置(jdbc)
/api/shadow/job/queryByAppName获取影子job任务配置
/api/link/guard/guardmanage获取挡板mock配置
/api/link/ds/server/configs/pull获取影子库/表配置(redis)
/api/link/es/server/configs/pull获取影子库/表配置(es)
/api/link/hbase/server/configs/pull获取影子库/表配置(hbase)
/api/link/kafka/cluster/configs/pull获取影子库/表配置(kafka,未使用)
/api/api/pull获取入口规则配置
/api/fast/agent/access/config/agentConfig查询agent动态配置(缺少接口,需匹配联调)
/api/agent/configs/shadow/consumer获取影子消费者配置


/api/agent/performance/basedata

有压测流量时,定时上报jvm线程、gc、内存信息。


大数据服务交互接口

上报链路信息

数据格式:V17

traceId|startTime|user_app_key(租户标识)|env_code(环境标识)|user_id(用户ID)|agentId|invokeId|invokeType|appName|cost|middlewareName|serviceName|methodName|resultCode|request|response|flags|callbackMsg|#samplingInterval|@nodeAttributes|@nodeLocalAttributes|@##attachment|@nodeAttributes|@nodeLocalAttributes

数据:

0100007f16717073558341438d02440001|1671707355836|default|test|1|10.0.44.46-580|0|0|seq-server|2185|tomcat|/sequence/api/uuid/v1/get|GET|200|||true~false~true~true||#1|@seq-server~/sequence/api/uuid/v1/get~GET|@seq-server~127.0.0.1~60179~0~0||@tn@a3d2fc8b4792f4837287d5b235d3ca7f@|@@st149:http-nio-8080-exec-1@nid4f605d9bdb8628e63d58a580d815910c@et149:http-nio-8080-exec-1
0100007f16717073911341444d02440001|1671707391134|default|test|1|10.0.44.46-580|0|0|seq-server|24|tomcat|/sequence/api/uuid/v1/get|GET|200|||true~false~true~true||#1|@seq-server~/sequence/api/uuid/v1/get~GET|@seq-server~127.0.0.1~60179~0~0||@tn@a3d2fc8b4792f4837287d5b235d3ca7f@|@@st150:http-nio-8080-exec-2@nid4f605d9bdb8628e63d58a580d815910c@et150:http-nio-8080-exec-2

上报errorLog

数据格式:V11

ip|port|timestamp|user_app_key(租户标识)|env_code(环境标识)|user_id(用户ID)|agentId|appName|agentLogInfo(日志信息)

数据:

127.0.0.1|0|1671499748248|default|test|1|10.0.44.46-2744|seq-server|can't found any available log server nodes!"
127.0.0.1|0|1671499748248|default|test|1|10.0.44.46-2744|seq-server|init log data pusher failed.retry next times."
127.0.0.1|0|1671499748874|default|test|1|10.0.44.46-2744|seq-server|获取控制台固定配置信息失败 url={}, result={}, 参数类型={}"

上报Monitor信息(指的是系统cpu、memory、io等信息)

数据格式:V13

appName|timestamp|user_app_key(租户标识)|env_code(环境标识)|user_id(用户ID)|agentId(simple)|cpuUsage%|cpuAvgLoad1|cpuAvgLoad5|cpuAvgLoad15|memoryUsage%

|totalMemory|availableMemory|cpuIoWaitUsage%|NetworkUsage|NetworkSpeed|cupCoreNum|totalDiskSpace|usableDiskSpace|diskReadBytes|diskWriteBytes|0 or 1(out or in docker)|version

数据:

seq-server|1671704245|default|test|1|10.0.44.46-580|0.88|-1.00|-1.00|-1.00|80.73|8585334784|1521553408|0|0|0|4|118000443392|11002114048|0|0|0|13
seq-server|1671704247|default|test|1|10.0.44.46-580|50.83|-1.00|-1.00|-1.00|82.28|8585334784|1521688576|0|0|0|4|118000443392|11002114048|0|0|0|13

发表评论 / Comment

用心评论~