Overview
You can call this API to query the metrics of an OceanBase Database tenant.
API details
Constraints
The caller must have an AccessKey for accessing APIs of OceanBase Cloud. For information about how to obtain the AccessKey ID and AccessKey secret, see Manage AccessKeys.
Request path
POST /api/v2/instances/{instanceId}/tenants/{tenantId}/metrics
Request parameters
Query
| Parameter | Type | Required | Description | Example value |
|---|---|---|---|---|
| InstanceId | String | Yes | The ID of the OceanBase cluster. | ob317v4uif**** |
| tenantId | String | Yes | The ID of the tenant. | tfafd34fs**** |
Body
| Parameter | Type | Required | Description | Example value |
|---|---|---|---|---|
| startTime | String | Yes | The start of the time range for querying metric data. The value must be UTC time in the format of YYYY-MM-DDThh:mm:ssZ. | 2021-06-13T15:40:43Z |
| endTime | String | Yes | The end of the time range for querying monitoring data. The value must be UTC time in the format of YYYY-MM-DDThh:mm:ssZ. | 2021-09-13T15:40:43Z |
| metrics | List |
Yes | The list of names of the metrics to query. | otal_sessions_tenant |
| tenantIdList | List |
No | The list of tenant IDs. | t4tx6u5tc**** |
| nodeIdList | List |
No | The list of OBServer node IDs. | i-0104c6fb57e6e**** |
Response parameters
| Parameter | Type | Description | Example value |
|---|---|---|---|
| Object | The return result of the request. | ||
| RequestId | String | The ID of the request. | EE205C00-30E4-****-****-87E3A8A2AA0C |
| data | List | The metric data of the tenant. | For more information, see the following sample code. |
Here is a sample value of data:
"data":[
{
"nodeId":"ins-122dhae",
"ip":"xx.xxx.xxx.xx",
"metrics":[
{
"total_sessions_tenant":0,
"timestamp":1687640160
},
{
"total_sessions_tenant":1,
"timestamp":1687661700
},
{
"total_sessions_tenant":1,
"timestamp":1687661760
}
]
}
]
Examples
Request example
curl --digest -u 'AccessKeyID:AccessKeySecret' \
--request POST \
--url https://api-cloud.oceanbase.com/api/v2/instances/{instanceId}/tenants/{tenantId}/metrics \
-H 'X-Ob-Project-Id: <Project ID>'
--data \
'{"refreshId":0,"metricKeys":["tps_tenant"],"drillDown":false,"startTime":"2023-06-19T05:32:56Z","endTime":"2023-06-19T06:32:56Z","metrics":["tps_tenant"]}'
Note
- A project ID uniquely identifies a project. For information about how to obtain the project ID of an instance, see Manage projects.
- Make sure that the project ID corresponding to the specified instanceId is consistent with the specified project ID.
Response example
JSON format
{
"RequestId": "EE205C00-30E4-XXXX-XXXX-87E3A8A2AA0C",
"data":[
{
"tenantName":"obmt4tpqx195803k",
"tenantId":"obmt4tpqx195803k",
"obTenantId":"obmt4tpqx195803k",
"metrics":[
{
"total_sessions_tenant":0,
"timestamp":1687640160
},
{
"total_sessions_tenant":1,
"timestamp":1687661700
},
{
"total_sessions_tenant":1,
"timestamp":1687661760
}
]
}
]
}