获取MySQL实例实时会话
更新时间:2024-11-15
接口描述
获取MySQL实例实时会话
权限说明
鉴权认证机制的详细内容请参见鉴权认证。
请求结构
GET /v{version}/diagnosis/mysql/session/list?appId=appId&nodeId=appId HTTP/1.1
Host: dbsc.bj.baidubce.com
Authorization: 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 | 会话总执行时间 |
请求示例
GET /v1/diagnosis/mysql/session/list?appId=rds-0mxm0cTI&nodeId=rds-0mxm0cTI
Host: dbsc.bj.baidubce.com
Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2023-07-11T11:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
响应示例
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
x-bce-request-id: d8752367-38e8-45e4-b4c7-e53be3137ce5
{
"items": [
{
"id": 788991,
"user": "event_scheduler",
"host": "localhost",
"db": "",
"command": "Daemon",
"time": 4649025,
"state": "Waiting on empty queue",
"sqlstmt": "",
"trxState": "",
"trxTime": 0
},
{
"id": 789384,
"user": "_sync",
"host": "192.168.65.148:34902",
"db": "",
"command": "Binlog Dump GTID",
"time": 4648536,
"state": "Master has sent all binlog to slave; waiting for binlog to be up",
"sqlstmt": "",
"trxState": "",
"trxTime": 0
},
{
"id": 7374082,
"user": "_sync",
"host": "192.168.65.148:50330",
"db": "",
"command": "Binlog Dump",
"time": 1110343,
"state": "Master has sent all binlog to slave; waiting for binlog to be up",
"sqlstmt": "",
"trxState": "",
"trxTime": 0
},
{
"id": 8636411,
"user": "test",
"host": "100.79.9.105:20351",
"db": "",
"command": "Sleep",
"time": 8,
"state": "",
"sqlstmt": "",
"trxState": "",
"trxTime": 0
},
{
"id": 4,
"user": "_root",
"host": "localhost",
"db": "mysql",
"command": "Sleep",
"time": 2,
"state": "",
"sqlstmt": "",
"trxState": "",
"trxTime": 0
},
{
"id": 3,
"user": "_root",
"host": "localhost",
"db": "mysql",
"command": "Sleep",
"time": 0,
"state": "",
"sqlstmt": "",
"trxState": "",
"trxTime": 0
}
],
"userStatistics": [
{
"userName": "event_scheduler",
"totalCount": 1,
"totalExecuteTime": 4649025,
"averageExecuteTime": 4649025,
"maxExecuteTime": 4649025,
"activeTotalCount": 1,
"activeTotalExecuteTime": 4649025,
"activeAverageExecuteTime": 4649025,
"activeMaxExecuteTime": 4649025
},
{
"userName": "_sync",
"totalCount": 2,
"totalExecuteTime": 5758879,
"averageExecuteTime": 2879439.5,
"maxExecuteTime": 4648536,
"activeTotalCount": 2,
"activeTotalExecuteTime": 5758879,
"activeAverageExecuteTime": 2879439.5,
"activeMaxExecuteTime": 4648536
},
{
"userName": "test",
"totalCount": 1,
"totalExecuteTime": 8,
"averageExecuteTime": 8,
"maxExecuteTime": 8,
"activeTotalCount": 0,
"activeTotalExecuteTime": 0,
"activeAverageExecuteTime": 0,
"activeMaxExecuteTime": 0
},
{
"userName": "_root",
"totalCount": 2,
"totalExecuteTime": 2,
"averageExecuteTime": 1,
"maxExecuteTime": 2,
"activeTotalCount": 0,
"activeTotalExecuteTime": 0,
"activeAverageExecuteTime": 0,
"activeMaxExecuteTime": 0
}
],
"databaseStatistics": [
{
"databaseName": "",
"totalCount": 4,
"totalExecuteTime": 10407912,
"averageExecuteTime": 2601978,
"maxExecuteTime": 4649025,
"activeTotalCount": 3,
"activeTotalExecuteTime": 10407904,
"activeAverageExecuteTime": 3469301.3333333335,
"activeMaxExecuteTime": 4649025
},
{
"databaseName": "mysql",
"totalCount": 2,
"totalExecuteTime": 2,
"averageExecuteTime": 1,
"maxExecuteTime": 2,
"activeTotalCount": 0,
"activeTotalExecuteTime": 0,
"activeAverageExecuteTime": 0,
"activeMaxExecuteTime": 0
}
],
"hostStatistics": [
{
"host": "localhost",
"totalCount": 3,
"totalExecuteTime": 4649027,
"averageExecuteTime": 1549675.6666666667,
"maxExecuteTime": 4649025,
"activeTotalCount": 1,
"activeTotalExecuteTime": 4649025,
"activeAverageExecuteTime": 4649025,
"activeMaxExecuteTime": 4649025
},
{
"host": "192.168.65.148",
"totalCount": 2,
"totalExecuteTime": 5758879,
"averageExecuteTime": 2879439.5,
"maxExecuteTime": 4648536,
"activeTotalCount": 2,
"activeTotalExecuteTime": 5758879,
"activeAverageExecuteTime": 2879439.5,
"activeMaxExecuteTime": 4648536
},
{
"host": "100.79.9.105",
"totalCount": 1,
"totalExecuteTime": 8,
"averageExecuteTime": 8,
"maxExecuteTime": 8,
"activeTotalCount": 0,
"activeTotalExecuteTime": 0,
"activeAverageExecuteTime": 0,
"activeMaxExecuteTime": 0
}
],
"summary": {
"totalCount": 6,
"totalExecuteTime": 10407914,
"averageExecuteTime": 1734652.3333333333,
"maxExecuteTime": 4649025,
"activeTotalCount": 3,
"activeTotalExecuteTime": 10407904,
"activeAverageExecuteTime": 3469301.3333333335,
"activeMaxExecuteTime": 4649025
}
}