Reviewed-by: Gladkov, Maksim <mgladkov@noreply.gitea.eco.tsi-dev.otc-service.com> Co-authored-by: wangdengke2 <wangdengke2@huawei.com> Co-committed-by: wangdengke2 <wangdengke2@huawei.com>
25 KiB
Monitoring Slow Query Logs (a V2 API)
Function
This API is used to query the SQL statements that take a long time to execute on the DDM instance within a specified time range.
Constraints
- This API is to be removed soon, so it is not recommended.
- Use the latest API. For details, see Monitoring Slow Query Logs (a V3 API).
URI
GET /v2/{project_id}/instances/{instance_id}/slowlog?curPage={curPage}&perPage={perPage}&startDate={startDate}&endDate={endDate}
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
project_id |
Yes |
String |
Project ID |
instance_id |
Yes |
String |
DDM instance ID |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
curPage |
Yes |
String |
Which page the server starts returning items. The start value cannot be less than 1. |
perPage |
Yes |
String |
Number of records displayed on each page |
startDate |
Yes |
String |
Start time. The format is UNIX timestamp, in milliseconds. |
endDate |
Yes |
String |
End time. The format is UNIX timestamp, in milliseconds. The interval between the start time and the end time must be no more than 7 days. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
X-Auth-Token |
Yes |
String |
User token. It can be obtained by calling an IAM API. The value of X-Subject-Token in the response header is the user token. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
|---|---|---|
totalRecord |
Integer |
Number of slow query logs |
slowLogList |
Array of SlowLogList objects |
Information about slow query logs |
Parameter |
Type |
Description |
|---|---|---|
users |
String |
Username of the DDM account for executing the slow SQL statement |
database |
String |
Name of the schema where the slow SQL statement is executed |
querySample |
String |
Syntax for executing the slow SQL statement |
logTime |
String |
Time when the slow SQL statement starts to be executed |
time |
String |
Time for a SQL statement to execute, accurate to milliseconds |
shards |
String |
Name of the physical shard |
rowsExamined |
String |
Number of rows affected by the SQL statements that take a long time to execute |
host |
String |
Client IP address. This IP address may involve personal data. Anonymizing the IP address data is recommended. |
ddmNodeId |
String |
ID of the DDM node for executing the slow SQL statement |
Status code: 400
Parameter |
Type |
Description |
|---|---|---|
errCode |
String |
Service error code |
externalMessage |
String |
Error message |
Status code: 500
Parameter |
Type |
Description |
|---|---|---|
errCode |
String |
Service error code |
externalMessage |
String |
Error message |
Example Request
GET https://ddm.eu-de.otc.t-systems.com/v2/619d3e78f61b4be68bc5aa0b59edcf7b/instances/1f5c9fd6cd984056ba89c8c87cc03278in09/slowlog?curPage=0&perPage=1&startDate=1758286647000&endDate=1758373047000
Example Response
Status code: 200
OK
{
"totalRecord" : 2,
"slowLogList" : [ {
"users" : "testddm",
"database" : "test1",
"querySample" : "select id, sleep(3) from test",
"logTime" : "2021-04-26T02:40:21",
"time" : "12002",
"shards" : "test1_0000",
"rowsExamined" : "4",
"host" : "192.168.16.18",
"ddmNodeId":"47667f9ed2a54af7ba9ca46d8d37c26f****"
} ]
}
Status code: 400
bad request
{
"externalMessage" : "Parameter error.",
"errCode" : "DBS.280001"
}
Status code: 500
server error
{
"externalMessage" : "Server failure.",
"errCode" : "DBS.200412"
}
Status Codes
Status Code |
Description |
|---|---|
200 |
OK |
400 |
bad request |
500 |
server error |
Error Codes
For details, see Error Codes.