Open Source, Open Future!
  menu
107 文章
ღゝ◡╹)ノ❤️

cat消息树

结构

在同一个线程里,产生的各个埋点会串联成一个消息树。

private ByteBuf m_buf;

// 服务名称
private String m_domain;

// 主机名
private String m_hostName;

// ip地址
private String m_ipAddress;

// transaction信息
private Message m_message;

// 消息id
private String m_messageId;

// 父消息id
private String m_parentMessageId;

// 根消息id
private String m_rootMessageId;

private String m_sessionToken;

// 线程组名称
private String m_threadGroupName;

// 线程id
private String m_threadId;

// 线程名称
private String m_threadName;

private boolean m_sample = true;

MessageTree经过编码之后如下:

PT1	web-a	PPC202007150330	10.10.141.70	main	71	http-nio-8080-exec-9	web-b-0a0a8d46-444200-57	web-b-0a0a8d46-444200-56	web-b-0a0a8d46-444200-56	null
t2020-09-03 16:25:14.917	URL	/api/findById-a
E2020-09-03 16:25:14.917	PigeonService.app	web-a	0
E2020-09-03 16:25:14.917	PigeonService.client	127.0.0.1	0
E2020-09-03 16:25:14.917	PigeonCall.app	web-b	0
E2020-09-03 16:25:14.917	URL	URL.Server	0	IPS=127.0.0.1&VirtualIP=127.0.0.1&Server=127.0.0.1&Referer=null&Agent=Apache-HttpClient/4.5.2 (Java/1.8.0_121)
E2020-09-03 16:25:14.917	URL	URL.Method	0	HTTP/GET /api/findById-a?id=hahahaha
T2020-09-03 16:25:14.918	URL	/api/findById-a	0	1037us

消息头

  • 第一行为消息头。
  • 字段依次为:version、domain、hostName、 ipAdress、 treadGroupName、 treadId、 threadName、 MessageId、 parentMessageId、 rootMessageId、 sessionToken。
  • 字段之间以"\t"分隔,并以"\n"结尾。
  • 空用null表示。

消息体

不同类型的消息有不同的标识。

t:Transaction开始
T:Transaction结束
E:Event
H:Heartbeat
M:Metric

http调用

例如有两个web应用:web-b、web-a。

1、web-a中有接口/api/findById-a

2、web-b中有接口/api/findById-b,这个接口内部会去调web-a的/api/findById-a接口

当调用/api/findById-b接口时,各个应用的报文如下所示。

web-b 报文如下:

PT1	web-b	PPC202007150330	10.10.141.70	main	70	http-nio-8081-exec-7	web-b-0a0a8d46-444200-56	null	null	null
t2020-09-03 16:25:14.914	URL	/api/findById-b
E2020-09-03 16:25:14.914	URL	URL.Server	0	IPS=127.0.0.1&VirtualIP=127.0.0.1&Server=localhost&Referer=null&Agent=PostmanRuntime/7.26.3
E2020-09-03 16:25:14.914	URL	URL.Method	0	HTTP/GET /api/findById-b?id=hahahaha
t2020-09-03 16:25:14.915	HttpCall	http://127.0.0.1:8080/api/findById-a
E2020-09-03 16:25:14.915	HTTP.url	http://127.0.0.1:8080/api/findById-a	0
E2020-09-03 16:25:14.915	HTTP.Request.Info	GET /api/findById-a?id=hahahaha HTTP/1.1 [Content-type: application/x-www-form-urlencoded;charset=UTF-8]	0
E2020-09-03 16:25:14.915	HTTP.Target.Host	http://127.0.0.1:8080	0
E2020-09-03 16:25:14.915	HTTP.Request.uri	/api/findById-a	0
E2020-09-03 16:25:14.915	HTTP.Request.Method	GET	0
E2020-09-03 16:25:14.915	HTTP.Request.ProtocolName	HTTP	0
E2020-09-03 16:25:14.915	RemoteCall		0	web-b-0a0a8d46-444200-57
E2020-09-03 16:25:14.915	PigeonCall.app	web-b	0
E2020-09-03 16:25:14.915	PigeonCall.port	8080	0
E2020-09-03 16:25:14.915	PigeonCall.server	127.0.0.1	0
T2020-09-03 16:25:14.917	HttpCall	http://127.0.0.1:8080/api/findById-a	0	2521us
T2020-09-03 16:25:14.918	URL	/api/findById-b	0	4782us

web-a 报文如下:

PT1	web-a	PPC202007150330	10.10.141.70	main	71	http-nio-8080-exec-9	web-b-0a0a8d46-444200-57	web-b-0a0a8d46-444200-56	web-b-0a0a8d46-444200-56	null
t2020-09-03 16:25:14.917	URL	/api/findById-a
E2020-09-03 16:25:14.917	PigeonService.app	web-a	0
E2020-09-03 16:25:14.917	PigeonService.client	127.0.0.1	0
E2020-09-03 16:25:14.917	PigeonCall.app	web-b	0
E2020-09-03 16:25:14.917	URL	URL.Server	0	IPS=127.0.0.1&VirtualIP=127.0.0.1&Server=127.0.0.1&Referer=null&Agent=Apache-HttpClient/4.5.2 (Java/1.8.0_121)
E2020-09-03 16:25:14.917	URL	URL.Method	0	HTTP/GET /api/findById-a?id=hahahaha
T2020-09-03 16:25:14.918	URL	/api/findById-a	0	1037us

dubbo调用

例如有两个web应用:web-a、dubbo-service。各个应用的报文如下所示。

web-a 报文如下:

PT1	web-a	PPC202007150330	10.10.141.70	main	69	scheduling-1	web-a-0a0a8d46-444224-156	null	null	null
t2020-09-04 16:26:59.558	DubboClient	DubboService.finfById
E2020-09-04 16:26:59.558	PigeonCall.app	dubbo-service		0
E2020-09-04 16:26:59.558	PigeonCall.port	12345	0
E2020-09-04 16:26:59.558	PigeonCall.server	10.10.141.70	0
E2020-09-04 16:26:59.558	RemoteCall		0	web-a-0a0a8d46-444224-157
E2020-09-04 16:28:59.513	DUBBO_TIMEOUT_ERROR	DubboService.finfById	com.alibaba.dubbo.rpc.RpcException
T2020-09-04 16:28:59.513	DubboClient	DubboService.finfById	RpcException	119955059us

dubbo-service 报文如下:

PT1	dubbo-service		PPC202007150330	10.10.141.70	main	147	DubboServerHandler-10.10.141.70:12345-thread-73	web-a-0a0a8d46-444224-157	web-a-0a0a8d46-444224-156	web-a-0a0a8d46-444224-156	null
t2020-09-04 16:27:24.814	DubboService	DubboService.finfById
E2020-09-04 16:27:24.814	PigeonService.app	web-a	0
E2020-09-04 16:27:24.814	PigeonService.client	10.10.141.70	0
T2020-09-04 16:27:34.334	DubboService	DubboService.finfById	0	9520666us

db调用

报文如下:

PT1	web-a	PPC202007150330	192.168.1.102	main	77	http-nio-8080-exec-7	web-a-c0a80166-444325-30454	null	null	null
t2020-09-08 21:24:29.979	URL	/user/save
E2020-09-08 21:24:29.979	URL	URL.Server	0	IPS=0:0:0:0:0:0:0:1&VirtualIP=0:0:0:0:0:0:0:1&Server=localhost&Referer=null&Agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36
E2020-09-08 21:24:29.979	URL	URL.Method	0	HTTP/GET /user/save
t2020-09-08 21:24:29.999	SQL	UsersMapper.insertSelective
E2020-09-08 21:24:30.021	SQL.Method	insert	0
E2020-09-08 21:24:30.021	SQL.Database	jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false	0
T2020-09-08 21:24:30.021	SQL	UsersMapper.insertSelective	0	22182us
T2020-09-08 21:24:30.082	URL	/user/save	0	103704us

dfs调用

报文如下:

PT1	web-c	PPC202007150330	10.10.141.70	main	32	http-nio-8080-exec-2	web-c-0a0a8d46-444488-50103	null	null	null
t2020-09-15 16:58:59.702	URL	/dfs/upload
E2020-09-15 16:58:59.707	URL	URL.Server	0	IPS=127.0.0.1&VirtualIP=127.0.0.1&Server=127.0.0.1&Referer=null&Agent=Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 UBrowser/6.2.3831.407 Safari/537.36
E2020-09-15 16:58:59.707	URL	URL.Method	0	HTTP/GET /dfs/upload
t2020-09-15 16:59:10.843	HttpCall	http://fs.test.com/UploadFile
E2020-09-15 16:59:10.843	HTTP.url	http://fs.test.com/UploadFile	0
E2020-09-15 16:59:10.844	HTTP.Request.Info	POST /UploadFile HTTP/1.1 []	0
E2020-09-15 16:59:10.845	HTTP.Target.Host	http://fs.test.com	0
E2020-09-15 16:59:10.845	HTTP.Request.uri	/UploadFile	0
E2020-09-15 16:59:10.845	HTTP.Request.Method	POST	0
E2020-09-15 16:59:10.845	HTTP.Request.ProtocolName	HTTP	0
E2020-09-15 16:59:18.820	RemoteCall		0	web-c-0a0a8d46-444488-50104
E2020-09-15 16:59:18.820	PigeonCall.app	web-c	0
E2020-09-15 16:59:18.820	PigeonCall.port	-1	0
E2020-09-15 16:59:18.820	PigeonCall.server	fs.test.ztosys.com	0
T2020-09-15 16:59:18.828	HttpCall	http://fs.test.com/UploadFile	0	7985662us
A2020-09-15 16:59:18.830	session	get	0	25us
T2020-09-15 16:59:18.830	URL	/dfs/upload	0	19128821us