Overview
You can call this API to query the real-time session information of a specified tenant in an OceanBase cluster. This API returns detailed statistics of active or all sessions and supports filtering by session status, SQL text, client IP, server IP, and user, facilitating session monitoring and performance analysis.
API details
Constraints
The caller must have an AccessKey for accessing the multi-cloud API. For information about how to obtain the AccessKey ID and AccessKey secret, see Manage AccessKeys.
Request path
GET /api/v2/instances/{instanceId}/tenants/{tenantId}/sessions
Request parameters
Path
| Parameter | Type | Required | Description |
|---|---|---|---|
| instanceId | String | Yes | The ID of the OceanBase cluster. |
| tenantId | String | Yes | The ID of the tenant. |
Query
| Parameter | Type | Required | Description |
|---|---|---|---|
| requestId | String | Yes | The request ID, used for request tracking. |
| status | String | No | The session status, used for filtering sessions by status. |
| sqlText | String | No | The SQL statement, used for filtering sessions by SQL text. |
| clientIp | String | No | The client IP address, used for filtering sessions by client IP. |
| serverIp | String | No | The server IP address, used for filtering sessions by server IP. |
| users | String | No | The username, used for filtering sessions by user. |
Response parameters
| Parameter | Type | Description |
|---|---|---|
| data | Object | The session process statistics. |
| requestId | String | The request ID. |
| success | Boolean | Indicates whether the request was successful. |
Examples
Request example
curl --digest -u '<Your ak:sk>' \
-X GET \
'https://api-cloud.oceanbase.com/api/v2/instances/{instanceId}/tenants/{tenantId}/sessions?requestId={requestId}&status={status}&sqlText={sqlText}&clientIp={clientIp}&serverIp={serverIp}&users={users}'
Response example
JSON format
{
"data": {},
"requestId": "dc302d76-66b5-48d8-ab53-a035********",
"success": true
}
