This topic describes how to query the deadlock history of a tenant by using an API. You can also specify the page number and page size.
Call the API
If a password is set, you must authenticate before you call the API. For more information, see API hybrid encryption.
Request path
GET /api/v1/tenant/:name/deadlocks
Request parameters
Parameter |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| name | string | Yes | t1 | The name of the tenant. This parameter is specified in the path. |
| page | uint64 | No | 1 | The page number. Default value: 1. This parameter is specified in the query parameter. |
| size | uint64 | No | 10 | The number of records per page. Default value: 2147483647. This parameter is specified in the query parameter. |
Response
Parameter |
Type |
Description |
|---|---|---|
| successful | bool | Indicates whether the request was successful. |
| timestamp | time.Time | The timestamp when the server completed the request. |
| duration | int | The time taken by the server to process the request, in milliseconds. |
| status | int | The HTTP status code. |
| traceId | string | The trace ID of the request. |
| data | PaginatedDeadLocks | The list of deadlocks on the specified page. The list contains the following information:
|
| error | ApiError | The error information. The error information contains the following fields:
|
Data structure of a DeadLock:
Parameter |
Type |
Description |
|---|---|---|
| event_id | string | The unique ID of the deadlock event. |
| report_time | time.Time | The time when the deadlock was reported. |
| size | int64 | The number of nodes in the deadlock cycle. |
| nodes | []DeadLockNode | The list of nodes in the deadlock cycle. For more information, see the Data structure of a DeadLockNode section below. |
Data structure of a DeadLockNode:
Parameter |
Type |
Description |
|---|---|---|
| svr_ip | string | The IP address of the server. |
| svr_port | int | The port number of the server. |
| idx | int | The index of the node in the deadlock cycle. |
| transaction_hash | string | The transaction hash. |
| roll_backed | bool | Indicates whether the transaction was rolled back. |
| resource | string | The resource requested by the transaction. |
| sql | string | The SQL statement executed by the transaction. |
Data structure of a CustomPage:
Parameter |
Type |
Description |
|---|---|---|
| total_elements | uint64 | The total number of records. |
| total_pages | uint64 | The total number of pages. |
| size | uint64 | The number of records per page. |
| number | uint64 | The page number. |
Examples
Request example
GET 10.10.10.1:2886/api/v1/tenant/t1/deadlocks?page=1&size=10
Response example
{
"successful": true,
"timestamp": "2025-12-31T15:28:15.176641858+08:00",
"duration": 44,
"status": 200,
"traceId": "3e659bf428d3fc4a",
"data": {
"page": {
"total_elements": 1,
"total_pages": 1,
"size": 10,
"number": 1
},
"contents": [
{
"event_id": "13571512715115989388",
"report_time": "2025-12-31T15:22:43.799838+08:00",
"size": 3,
"nodes": [
{
"svr_ip": "10.10.10.1",
"svr_port": 2882,
"idx": 2,
"transaction_hash": "2004",
"roll_backed": false,
"resource": "{addr:\"10.10.10.1:2882\"}:{ls:1001}:{tablet:200001}:{row_key:{\"INT\":2}}",
"sql": "Y0-0000000000000000-0-0:UPDATE deadlock_test SET value = value + 1 WHERE id = 2"
},
{
"svr_ip": "10.10.10.1",
"svr_port": 2882,
"idx": 3,
"transaction_hash": "2007",
"roll_backed": false,
"resource": "{addr:\"10.10.10.1:2882\"}:{ls:1001}:{tablet:200001}:{row_key:{\"INT\":3}}",
"sql": "Y0-0000000000000000-0-0:UPDATE deadlock_test SET value = value + 2 WHERE id = 3"
},
{
"svr_ip": "10.10.10.1",
"svr_port": 2882,
"idx": 1,
"transaction_hash": "2008",
"roll_backed": true,
"resource": "{addr:\"10.10.10.1:2882\"}:{ls:1001}:{tablet:200001}:{row_key:{\"INT\":1}}",
"sql": "Y0-0000000000000000-0-0:UPDATE deadlock_test SET value = value + 3 WHERE id = 1"
}
]
}
]
}
}
