获取MySQL实例实时会话
更新时间:2024-11-15
接口描述
获取MySQL实例实时会话
权限说明
鉴权认证机制的详细内容请参见鉴权认证。
请求结构
JSON
1GET /v{version}/diagnosis/mysql/session/list?appId=appId&nodeId=appId HTTP/1.1
2Host: dbsc.bj.baidubce.com
3Authorization: authorization string
请求头域
除公共头域外,无其它特殊头域。
请求参数
参数名称 | 类型 | 必选 | 参数位置 | 描述 |
---|---|---|---|---|
version | string | 是 | URL参数 | API版本号 |
appId | string | 是 | URL参数 | 集群ID |
nodeId | string | 是 | Query参数 | 节点ID |
响应头域
除公共头域外,无其它特殊头域。
响应参数
参数名称 | 类型 | 描述 |
---|---|---|
items | List |
实时会话列表信息 |
databaseStatistics | List |
数据库统计信息 |
hostStatistics | List |
源端Host统计信息 |
userStatistics | List |
用户统计信息 |
summary | List |
整体统计信息 |
MySQLSession
参数名称 | 类型 | 描述 |
---|---|---|
command | string | 数据库线程命令 |
db | string | 数据库名称 |
host | string | 数据库IP:Port |
id | integer | 会话ID |
sqlstmt | string | 执行的SQL |
state | string | 数据库线程状态 |
time | integer | SQL执行时间 |
trxState | string | 事务状态 |
trxTime | integer | 事务执行时间 |
user | string | 数据库用户 |
MysqlSessionDBSummary
参数名称 | 类型 | 描述 |
---|---|---|
databaseName | string | 数据库名称 |
activeAverageExecuteTime | double | 活跃会话平均执行时间 |
activeMaxExecuteTime | double | 活跃会话最长执行时间 |
activeTotalCount | integer | 活跃会话总数 |
activeTotalExecuteTime | double | 活跃会话总执行时间 |
averageExecuteTime | double | 会话平均执行时间 |
maxExecuteTime | double | 会话最长执行时间 |
totalCount | integer | 会话总数 |
totalExecuteTime | double | 会话总执行时间 |
MysqlSessionHostSummary
参数名称 | 类型 | 描述 |
---|---|---|
host | string | 数据库源主机 |
activeAverageExecuteTime | double | 活跃会话平均执行时间 |
activeMaxExecuteTime | double | 活跃会话最长执行时间 |
activeTotalCount | integer | 活跃会话总数 |
activeTotalExecuteTime | double | 活跃会话总执行时间 |
averageExecuteTime | double | 会话平均执行时间 |
maxExecuteTime | double | 会话最长执行时间 |
totalCount | integer | 会话总数 |
totalExecuteTime | double | 会话总执行时间 |
MysqlSessionUserSummary
参数名称 | 类型 | 描述 |
---|---|---|
activeAverageExecuteTime | double | 活跃会话平均执行时间 |
activeMaxExecuteTime | double | 活跃会话最长执行时间 |
activeTotalCount | integer | 活跃会话总数 |
activeTotalExecuteTime | double | 活跃会话总执行时间 |
averageExecuteTime | double | 会话平均执行时间 |
maxExecuteTime | double | 会话最长执行时间 |
totalCount | integer | 会话总数 |
totalExecuteTime | double | 会话总执行时间 |
userName | string | 数据库用户 |
MySQLSessionSummary
参数名称 | 类型 | 描述 |
---|---|---|
activeAverageExecuteTime | double | 活跃会话平均执行时间 |
activeMaxExecuteTime | double | 活跃会话最长执行时间 |
activeTotalCount | integer | 活跃会话总数 |
activeTotalExecuteTime | double | 活跃会话总执行时间 |
averageExecuteTime | double | 会话平均执行时间 |
maxExecuteTime | double | 会话最长执行时间 |
totalCount | integer | 会话总数 |
totalExecuteTime | double | 会话总执行时间 |
请求示例
JSON
1GET /v1/diagnosis/mysql/session/list?appId=rds-0mxm0cTI&nodeId=rds-0mxm0cTI
2Host: dbsc.bj.baidubce.com
3Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2023-07-11T11:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
响应示例
JSON
1HTTP/1.1 200 OK
2Content-Type: application/json;charset=UTF-8
3x-bce-request-id: d8752367-38e8-45e4-b4c7-e53be3137ce5
4{
5 "items": [
6 {
7 "id": 788991,
8 "user": "event_scheduler",
9 "host": "localhost",
10 "db": "",
11 "command": "Daemon",
12 "time": 4649025,
13 "state": "Waiting on empty queue",
14 "sqlstmt": "",
15 "trxState": "",
16 "trxTime": 0
17 },
18 {
19 "id": 789384,
20 "user": "_sync",
21 "host": "192.168.65.148:34902",
22 "db": "",
23 "command": "Binlog Dump GTID",
24 "time": 4648536,
25 "state": "Master has sent all binlog to slave; waiting for binlog to be up",
26 "sqlstmt": "",
27 "trxState": "",
28 "trxTime": 0
29 },
30 {
31 "id": 7374082,
32 "user": "_sync",
33 "host": "192.168.65.148:50330",
34 "db": "",
35 "command": "Binlog Dump",
36 "time": 1110343,
37 "state": "Master has sent all binlog to slave; waiting for binlog to be up",
38 "sqlstmt": "",
39 "trxState": "",
40 "trxTime": 0
41 },
42 {
43 "id": 8636411,
44 "user": "test",
45 "host": "100.79.9.105:20351",
46 "db": "",
47 "command": "Sleep",
48 "time": 8,
49 "state": "",
50 "sqlstmt": "",
51 "trxState": "",
52 "trxTime": 0
53 },
54 {
55 "id": 4,
56 "user": "_root",
57 "host": "localhost",
58 "db": "mysql",
59 "command": "Sleep",
60 "time": 2,
61 "state": "",
62 "sqlstmt": "",
63 "trxState": "",
64 "trxTime": 0
65 },
66 {
67 "id": 3,
68 "user": "_root",
69 "host": "localhost",
70 "db": "mysql",
71 "command": "Sleep",
72 "time": 0,
73 "state": "",
74 "sqlstmt": "",
75 "trxState": "",
76 "trxTime": 0
77 }
78 ],
79 "userStatistics": [
80 {
81 "userName": "event_scheduler",
82 "totalCount": 1,
83 "totalExecuteTime": 4649025,
84 "averageExecuteTime": 4649025,
85 "maxExecuteTime": 4649025,
86 "activeTotalCount": 1,
87 "activeTotalExecuteTime": 4649025,
88 "activeAverageExecuteTime": 4649025,
89 "activeMaxExecuteTime": 4649025
90 },
91 {
92 "userName": "_sync",
93 "totalCount": 2,
94 "totalExecuteTime": 5758879,
95 "averageExecuteTime": 2879439.5,
96 "maxExecuteTime": 4648536,
97 "activeTotalCount": 2,
98 "activeTotalExecuteTime": 5758879,
99 "activeAverageExecuteTime": 2879439.5,
100 "activeMaxExecuteTime": 4648536
101 },
102 {
103 "userName": "test",
104 "totalCount": 1,
105 "totalExecuteTime": 8,
106 "averageExecuteTime": 8,
107 "maxExecuteTime": 8,
108 "activeTotalCount": 0,
109 "activeTotalExecuteTime": 0,
110 "activeAverageExecuteTime": 0,
111 "activeMaxExecuteTime": 0
112 },
113 {
114 "userName": "_root",
115 "totalCount": 2,
116 "totalExecuteTime": 2,
117 "averageExecuteTime": 1,
118 "maxExecuteTime": 2,
119 "activeTotalCount": 0,
120 "activeTotalExecuteTime": 0,
121 "activeAverageExecuteTime": 0,
122 "activeMaxExecuteTime": 0
123 }
124 ],
125 "databaseStatistics": [
126 {
127 "databaseName": "",
128 "totalCount": 4,
129 "totalExecuteTime": 10407912,
130 "averageExecuteTime": 2601978,
131 "maxExecuteTime": 4649025,
132 "activeTotalCount": 3,
133 "activeTotalExecuteTime": 10407904,
134 "activeAverageExecuteTime": 3469301.3333333335,
135 "activeMaxExecuteTime": 4649025
136 },
137 {
138 "databaseName": "mysql",
139 "totalCount": 2,
140 "totalExecuteTime": 2,
141 "averageExecuteTime": 1,
142 "maxExecuteTime": 2,
143 "activeTotalCount": 0,
144 "activeTotalExecuteTime": 0,
145 "activeAverageExecuteTime": 0,
146 "activeMaxExecuteTime": 0
147 }
148 ],
149 "hostStatistics": [
150 {
151 "host": "localhost",
152 "totalCount": 3,
153 "totalExecuteTime": 4649027,
154 "averageExecuteTime": 1549675.6666666667,
155 "maxExecuteTime": 4649025,
156 "activeTotalCount": 1,
157 "activeTotalExecuteTime": 4649025,
158 "activeAverageExecuteTime": 4649025,
159 "activeMaxExecuteTime": 4649025
160 },
161 {
162 "host": "192.168.65.148",
163 "totalCount": 2,
164 "totalExecuteTime": 5758879,
165 "averageExecuteTime": 2879439.5,
166 "maxExecuteTime": 4648536,
167 "activeTotalCount": 2,
168 "activeTotalExecuteTime": 5758879,
169 "activeAverageExecuteTime": 2879439.5,
170 "activeMaxExecuteTime": 4648536
171 },
172 {
173 "host": "100.79.9.105",
174 "totalCount": 1,
175 "totalExecuteTime": 8,
176 "averageExecuteTime": 8,
177 "maxExecuteTime": 8,
178 "activeTotalCount": 0,
179 "activeTotalExecuteTime": 0,
180 "activeAverageExecuteTime": 0,
181 "activeMaxExecuteTime": 0
182 }
183 ],
184 "summary": {
185 "totalCount": 6,
186 "totalExecuteTime": 10407914,
187 "averageExecuteTime": 1734652.3333333333,
188 "maxExecuteTime": 4649025,
189 "activeTotalCount": 3,
190 "activeTotalExecuteTime": 10407904,
191 "activeAverageExecuteTime": 3469301.3333333335,
192 "activeMaxExecuteTime": 4649025
193 }
194}