TiDB 指标查询
接口URL
/api/v1/cluster/metrics/query
请求方式
POST
Content-Type
application/json
认证方式
Bearer auth
请求Header参数
参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述 |
---|---|---|---|---|
Accept | application/json | Text | 是 | - |
Content-Type | application/json | Text | 是 | - |
请求Body参数
{
"QueryReq":{
"StartTimeSec": 1695277860,
"EndTimeSec": 1695290868,
"StepSec": 30,
"Query": "sum(rate(tidb_server_handle_query_duration_seconds_sum{sql_type!=\"internal\"}[120s]))"
},
"clusterID": "tidb-f91e1f860d360502"
}
参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述 |
---|---|---|---|---|
QueryReq | - | Object | 是 | - |
QueryReq.StartTimeSec | 1695277860 | Integer | 是 | 开始时间 |
QueryReq.EndTimeSec | 1695290868 | Integer | 是 | 结束时间 |
QueryReq.StepSec | 30 | Integer | 是 | 周期 |
QueryReq.Query | sum(rate(tidbserver_handle query_duration_seconds_sum{sql _type!="internal"}[120s])) |
String | 是 | 查询SQL |
clusterID | tidb-f91e1f860d360502 | String | 是 | 集群ID |
成功响应示例
{
"Data": {
"status": "success",
"data": {
"resultType": "matrix",
"result": [{
"metric": {
"instance": "",
"sql_type": "",
"type": "",
"result": "",
"txn_mode": ""
},
"values": [
[1695277860, "0.0002227331333335181"],
[1695277890, "0.0002227331333335181"],
[1695277920, "0.00010823299047615364"],
[1695277950, "0"],
]
}]
}
},
"Success": true
}
参数名 | 示例值 | 参数类型 | 参数描述 |
---|---|---|---|
Data | - | Object | |
Data.status | success | String | |
Data.data | - | Object | |
Data.data.resultType | matrix | String | 图表类型 |
Data.data.result | - | Array | |
Data.data.result.metric | - | Object | |
Data.data.result.metric.instance | - | String | 实例类型 |
Data.data.result.metric.sql_type | - | String | sql类型 |
Data.data.result.metric.type | - | String | l类型 |
Data.data.result.metric.result | - | String | 结果 |
Data.data.result.metric.txn_mode | - | String | |
Data.data.result.values | - | Array | |
Data.data.result.values.0 | 1695277860 | Integer | 指标值 |
Data.data.result.values.1 | 0.0002227331333335181 | String | |
Success | true | Boolean |