Description
You can call this operation to query the metadata of the metrics provided by the OCP application and use the metadata to further query the corresponding monitoring data.
Call description
Prerequisite
You have passed the authentication for the OCP application service.
Request path
GET /api/v2/monitor/metricGroups
Request parameters
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
| page | Integer | No | 1 | The number of the page to return. Pages start from page 1. Default value: 1. |
| size | Integer | No | 10 | The number of entries to return on each page. 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: To query the metadata of a Top N metric. * NORMAL: To query the metadata of a common metric. |
| scope | String | Yes | CLUSTER | The scope of the metric queried. Valid values: * CLUSTER: To query a cluster metric. * TENANT: To query a tenant metric. * HOST: To query a host metric. * OBPROXY: To query an OBProxy metric. |
Response parameters
- Basic data structure
| Parameter | Type | Description |
|---|---|---|
| data | Object | The request data. |
| ├─ contents | Array | The metadata of the metric category. The subsequent table describes the structure of the metadata. |
| ├─ page | Object | The page information. |
| ├─ totalElements | Integer | The total number of entries. |
| ├─ totalPage | Integer | The total number of pages. |
| ├─ number | Integer | The page number of the returned page. |
| ├─ size | Integer | The number of entries returned per page. |
| successful | Boolean | Indicates whether the request was successful. |
| timestamp | Datetime | The timestamp when the server completed the request. |
| duration | Integer | The time that the server takes to process the request, in milliseconds. |
| status | Integer | The encoding in compliance with the HTTP Status specification. |
| traceId | String | The trace ID of the request. This trace ID is used for troubleshooting. |
| server | String | The address of the server that responded 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. * Internationalization is supported. |
| description | String | The description of the metric category. * Internationalization is supported. |
| scope | String | The metric scope. Valid values: * CLUSTER: a cluster metric * TENANT: a tenant metric * HOST: a host metric * OBPROXY: an OBProxy metric |
| type | String | The metric type. Valid values: * TOP: To query the metadata of a Top N metric. * NORMAL: To query the metadata of 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. * Internationalization is supported. |
| description | String | The description of the metric group. * Internationalization is supported. |
| metrics | Array | The array of the metric metadata. For more information about its data structure, see the following table. |
| withLabel | Boolean | 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. Internationalization is supported. |
| description | String | The description of the metric. Internationalization is supported. |
| unit | String | The unit of the metric. |
| displayByDefault | Boolean | 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
{
"duration":5,
"server":"xxx.xxx.xxx.xxx",
"status":200,
"successful":true,
"timestamp":"2020-11-11T15:46:03.216+08:00",
"traceId":"2a37968df71c4912",
"data":{
"contents":[
{
"description":"Cluster top metrics",
"id":6,
"key":"metric_cluster_top",
"metricGroups":[
{
"description":"The average number of SQL statements processed per second",
"id":47,
"key":"QPS",
"metrics":[
{
"description":"The number of SQL statements processed per second",
"displayByDefault":true,
"id":1000061,
"key":"sql_all_count",
"name":"all",
"unit":"times/s"
}
],
"name":"QPS",
"withLabel":false
},
{
"description":"The average time consumed for processing each SQL statement on the server",
"id":48,
"key":"QPS_RT",
"metrics":[
{
"description":"The average time consumed for processing each SQL statement on the server",
"displayByDefault":true,
"id":1000062,
"key":"sql_all_rt",
"name":"all",
"unit":"us"
}
],
"name":"Query response time",
"withLabel":false
},
{
"description":"Number of active sessions",
"id":49,
"key":"active_session",
"metrics":[
{
"description":"Number of active sessions",
"displayByDefault":true,
"id":1000063,
"key":"active_session",
"name":"active_session",
"unit":""
}
],
"name":"Number of active sessions",
"withLabel":false
},
{
"Description":"CPU utilization",
"id":50,
"key":"cpu_percent",
"metrics":[
{
"Description":"CPU utilization",
"displayByDefault":true,
"id":1000060,
"key":"cpu_percent",
"name":"cpu_percent",
"unit":"percent"
}
],
"name":"CPU utilization",
"withLabel":false
}
],
"name":"Cluster top metrics",
"scope":"CLUSTER",
"type":"TOP"
}
],
"page":{
"number":1,
"size":2000,
"totalElements":1,
"totalPages":1
}
}
}