Feature description
Queries the descriptions of the metrics provided by the current OCP application. You can use the descriptions to query the corresponding monitoring data.
Call instructions
Interface constraints
The caller needs to authenticate through the OCP application service.
Request path
GET /api/v2/monitor/metricGroups
Request parameters
body:
Parameter |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| page | Integer | No | 1 | The page number of the requested data. The value starts from 1, and the default value is 1. |
| size | Integer | No | 10 | The size of the requested data. The default value is 10, and the maximum value is 2000. |
| sort | String | No | asc,name | The sorting rule for the requested data. By default, it is sorted by ID in ascending order. |
| type | String | Yes | TOP | The type of the metric. Valid values: |
| scope | String | Yes | CLUSTER | The scope of the metric. Valid values: |
| target | String | No | OBCLUSTER | The type of the metric metadata. Valid values: |
| targetId | Integer | No | 1 | The ID of the metric metadata. Valid values: target is OBCLUSTER, OceanBase cluster ID is passed in.target is OBPROXY, OBProxy cluster ID is passed in. |
Response
Basic data structure
Parameter |
Type |
Description |
|---|---|---|
| data | Object | The requested data. |
| ├─ contents | Array | The metadata of the metric categories. For more information, see Metric category data structure. |
| ├─ page | Object | The pagination information. For more information, see page data structure. |
| successful | Boolean | Indicates whether the request succeeded. |
| timestamp | Datetime | The timestamp when the server completes the request. |
| duration | Integer | The time taken by the server to process the request, in milliseconds. |
| status | Integer | The HTTP status code that conforms to the HTTP Status specification. |
| traceId | String | The Trace ID of the request, which is used for troubleshooting. |
| server | String | The address of the server that responds to the request. |
Metric category data structure
Parameter |
Type |
Description |
|---|---|---|
| id | Integer | The ID of the metric category. |
| key | String | The encoded name of the metric category. |
| name | String | The name of the metric category, which supports internationalization. |
| description | String | The description of the metric category, which supports internationalization. |
| scope | String | The scope of the metrics. |
| type | String | The type of the metrics. |
| metricGroups | Array | The array of metric groups. For more information, see Metric group data structure. |
| dimensions | Array | The list of dimensions. |
| defaultDimension | String | The default dimension. |
Metric group data structure
Parameter |
Type |
Description |
|---|---|---|
| id | Integer | The ID of the metric group. |
| key | String | The encoded name of the metric group. |
| name | String | The name of the metric group, which supports internationalization. |
| description | String | The description of the metric group, which supports internationalization. |
| metrics | Array | The array of metric metadata. For more information, see Metric metadata data structure. |
| withLabel | Boolean | Indicates whether the monitoring data group contains labels. |
| dimension | String | The dimension. |
Metric metadata data structure
Parameter |
Type |
Description |
|---|---|---|
| id | Integer | The ID of the metric. |
| key | String | The encoded name of the metric. |
| name | String | The name of the metric, which supports internationalization. |
| description | String | The description of the metric, which supports internationalization. |
| unit | String | The unit of the metric. |
| displayByDefault | Boolean | Specifies whether to display the metric by default. |
page data structure
Parameter |
Type |
Description |
|---|---|---|
| totalElements | Integer | The total number of records. |
| totalPages | Integer | The total number of pages. |
| number | Integer | The current page number. |
| size | Integer | The size of the current page. |
Example
Request example
Query the metadata of metrics in the Top category:
GET /api/v2/monitor/metricGroups?scope=CLUSTER&type=TOP
Response example
{
"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": "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"
}
