Description
You can call this operation to query the description of the metrics provided by the OceanBase Cloud Platform (OCP) application and further query the corresponding monitoring data based on the description.
Description
Prerequisites
You have passed the authentication for the OCP application service.
Request path
GET /api/v2/monitor/metricGroups
path:
| Parameter | Type | Required | Example value | Description |
|---|---|---|---|---|
| page | Integer | No | 1 | The number of the page to return. The value starts from 1. Default value: 1. |
| size | Integer | No | 10 | The number of records to return on each page. The number of records to return per page. Default value: 10. Maximum value: 2000. |
| sort | String | No | asc,name | Sorting of the requested data. By default, the requested data is sorted in ascending order by ID. |
| type | String | Yes | TOP | The type of the metric queried. Valid values:TOP: queries the metadata of a Top N metric.NORMAL: queries the metadata of a common metric. |
| scope | String | Yes | CLUSTER | The scope of the metric queried. Valid values:CLUSTER: queries a cluster metric.TENANT: queries a tenant metric.HOST: queries a host metric.OBPROXY: queries an OBProxy metric. |
| target | String | No | OBCLUSTER | The metadata type of the metric queried. Valid values:OBCLUSTER: OceanBase cluster.OBPROXY: OBProxy cluster. |
| targetId | Integer | No | 1 | The metadata ID of the metric queried. target to OBCLUSTER, specify the ID of the OceanBase cluster for this parameter.target to OBPROXY, specify the ID of the OBProxy cluster. |
Response parameters
Basic data structure
| Parameter | Type | Description |
|---|---|---|
| data | Object | The requested data. |
| ├─ contents | Array | The metadata of the metric category. The subsequent table describes the structure of the metadata. |
| ├─ page | Object | The pagination information. |
| ├─ totalElements | Integer | The total number of records. |
| ├─ totalPage | Integer | The total number of pages. |
| ├─ number | Integer | The page number of the current page. |
| ├─ size | Integer | The number of records on the current page. |
| successful | Boolean | Indicates whether the request was successful. |
| timestamp | Datetime | The timestamp when the server completed the request. |
| duration | Integer | The amount of time taken by the server to process the request, in milliseconds. |
| status | Integer | The HTTP status code. |
| traceId | String | The trace ID of the request. This trace ID is used for troubleshooting. |
| server | String | The address of the server that responds to the request. |
Data structure of metric categories
| Parameter | Type | Description |
|---|---|---|
| id | Integer | The ID of the metric category. |
| key | String | The code name of the metric category. |
| name | String | The name of the metric category. |
| description | String | The description of the metric category. |
| scope | String | The scope of the metric queried. Valid values:CLUSTER: a cluster metric.TENANT: a tenant metric.HOST: a host metric.OBPROXY: an OBProxy metric. |
| type | String | The type of the metric queried. Valid values:TOP: a Top N metric.NORMAL: a common metric. |
| metricGroups | Array | The array of the metric group. For more information about its data structure, see the following table. |
Data structure of metric groups
| Parameter | Type | Description |
|---|---|---|
| id | Integer | The ID of the metric group. |
| key | String | The code name of the metric group. |
| name | String | The name of the metric group. |
| description | String | The description of the metric group. |
| metrics | Array | The array of the metric metadata. For more information about its data structure, see the following table. |
| withLabel | Boolean | Indicates whether the metric group has tags. |
- Data structure of metric metadata
| Parameter | Type | Description |
|---|---|---|
| id | Integer | The ID of the metric. |
| key | String | The code name of the metric. |
| name | String | The name of the metric. |
| description | String | The description of the metric. |
| unit | String | The unit of the metric. |
| displayByDefault | Boolean | Indicates whether the metric is displayed by default. |
Examples
Sample request
Query the metadata of cluster-level Top N metrics:
GET /api/v2/monitor/metricGroups?scope=CLUSTER&type=TOP
Sample response
{
"data": {
"contents": [
{
"defaultDimension": "",
"description": "OBProxy service monitoring",
"dimensions": [
""
],
"id": 6000036,
"key": "obproxy_service_metrics",
"metricGroups": [
{
"className": "obproxy_service_metrics",
"description": "TPS",
"dimension": "",
"id": 6002348,
"key": "transaction",
"metrics": [
{
"alarmEnabled": false,
"description": "The number of transactions per second.",
"displayByDefault": true,
"id": 9007073,
"interval": 1,
"isBuiltIn": true,
"key": "transaction_total",
"labels": "obproxy_cluster,obproxy_cluster_id,svr_ip",
"name": "total",
"order": 10000,
"unit": ""
}
],
"name": "TPS",
"order": 1,
"withLabel": false
},
]
}
],
"page": {
"number": 1,
"size": 5000,
"totalElements": 1,
"totalPages": 1
}
},
"duration": 39,
"server": "b3b6d90167",
"status": 200,
"successful": true,
"timestamp": "2025-01-15T14:29:23.522+08:00",
"traceId": "62e7ffd33dfccb11"
}