Query Monitoring Data for Partial Dimensions
Updated at:2025-11-03
API description
Monitor data from cloud products within a specified time range can be fetched using multiple dimensions, a single metric, and various statistics.
API restriction
- For any metric of a specific instance, the number of data points returned in one response cannot exceed 1,440.
- Each query can include up to 100 dimension combinations.
Request structure
- Method: POST
- Url: /csm/api/v2/userId/{userId}/services/{service}/data/metricData/PartialDimension
Request parameters
| Name | Types | Description | Required or not | Parameter location |
|---|---|---|---|---|
| userId | String | User ID | Yes | Path |
| service | String | Cloud product identifier. For values, refer to [Cloud Product Identifier List](BCM/Cloud Product Monitor List/Cloud Product Monitor Object Type List.md) | Yes | Path |
| startTime | String | Monitor data start time, refer to [Date and Time](BCM/API Reference/General Description.md), expressed in UTC date | Yes | Body |
| endTime | String | Monitor data end time, refer to [Date and Time](BCM/API Reference/General Description.md), expressed in UTC date | Yes | Body |
| statistics | List<String> | List of Statistic Method Types, options: average, maximum, minimum, sum, sampleCount. | Yes | Body |
| cycle | int | Statistical period, unit: second, default value: 60 | No | Body |
| dimensions | List<Dimension> | Dimension list | Yes | Body |
| resourceType | String | Monitor object type. For values, refer to [Cloud Product Monitor Object Type List](BCM/Cloud Product Monitor List/Cloud Product Monitor Object Type List.md) | No | Body |
| metricName | String | Monitor Metric name | Yes | Body |
| region | String | Region identifier. For values, refer to [Region List](BCM/API Reference/Service domain.md) | No | Body |
| pageNo | int | Page number, defaulting to 1 | No | Body |
| pageSize | int | Page size, default: 10, maximum: 100 | No | Body |
Dimension
| Name | Types | Description | Required or not |
|---|---|---|---|
| name | String | Dimension key | Yes |
| value | String | Dimension value | Yes |
Response parameters
| Name | Types | Description |
|---|---|---|
| requestId | String | Request identifier |
| code | String | Return code |
| message | String | Error message |
| result | PageResult | Paginated results |
PageResult
| Name | Types | Description |
|---|---|---|
| pageNo | int | Page number |
| pageSize | int | Page size |
| totalCount | int | Total count |
| result | List<AllDataMetric> | List of Monitor Metrics |
AllDataMetric
| Name | Types | Description |
|---|---|---|
| region | String | Region identifier |
| scope | String | Cloud product identifier |
| userId | String | User ID |
| resourceId | String | Resource ID |
| metricName | String | Monitor Metric name |
| dimensions | List<Dimensions> | Dimension list |
| dataPoints | List<DataPoint> | Monitor Metric data |
DataPoint
| Name | Types | Description |
|---|---|---|
| average | double | Average of Metrics within the statistical period |
| sum | double | Sum of Metrics within the statistical period |
| minimum | double | Minimum value of Metrics within the statistical period |
| maximum | double | Maximum value of Metrics within the counting cycle |
| sampleCount | int | Number of DataPoints for the Metric within the statistical period |
| timestamp | String | Time corresponding to the monitor data |
Request example
Go
1ak := "ALTAKr*****************CYG"
2sk := "b2c53**********************93ac1"
3userId := "a0d04***********************2ce4"
4endpoint := "http://bcm.bj.baidubce.com"
5bcmClient, _ := NewClient(ak, sk, endpoint)
6req := &model.MetricsByPartialDimensionsRequest{
7 UserID: userId,
8 Scope: "BCE_BLB",
9 Region: "bj",
10 Dimensions: []model.Dimension{
11 {
12 Name: "BlbPortType",
13 Value: "TCP",
14 },
15 },
16 Statistics: []string{"sum"},
17 ResourceType: "Blb",
18 MetricName: "ActiveConnCount",
19 StartTime: "2024-03-20T02:21:17Z",
20 EndTime: "2024-03-20T03:21:17Z",
21 PageNo: 1,
22 PageSize: 1,
23}
24response, err := bcmClient.GetMetricsByPartialDimensions(req)
Response example
JSON
1{
2 "requestId": "bfdb5d91-39e6-4c35-aa73-caf76ad3440f",
3 "code": "success",
4 "message": "",
5 "result": {
6 "pageNo": 1,
7 "pageSize": 1,
8 "totalCount": 66,
9 "result": [{
10 "region": "bj",
11 "scope": "BCE_BLB",
12 "userId": "a0d04d7c***************7b6752ce4",
13 "resourceId": "lb-****8446",
14 "metricName": "ActiveConnCount",
15 "dimensions": [{
16 "name": "BlbId",
17 "value": "lb-****8446"
18 }, {
19 "name": "BlbPort",
20 "value": "3306"
21 }, {
22 "name": "BlbPortType",
23 "value": "TCP"
24 }],
25 "dataPoints": [{
26 "sum": 0.0,
27 "timestamp": "2024-03-20T02:21:17Z"
28 }, {
29 "sum": 0.0,
30 "timestamp": "2024-03-20T02:22:17Z"
31 },
32 // Intermediate points omitted
33 {
34 "sum": 0.0,
35 "timestamp": "2024-03-20T03:19:17Z"
36 }, {
37 "sum": 0.0,
38 "timestamp": "2024-03-20T03:20:17Z"
39 }, {
40 "timestamp": "2024-03-20T03:21:17Z"
41 }]
42 }]
43 }
44}
