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
Java
1// config of client
2String endpoint = "http://bcm.bj.baidubce.com";
3String userId = "a0d04d7c***************7b6752ce4";
4String ak = "ALTAK***************3hVCYG";
5String sk = "b2c53*******************f9993ac1";
6// create a bcm client
7BcmClientConfiguration config = new BcmClientConfiguration();
8config.setCredentials(new DefaultBceCredentials(ak, sk));
9config.setEndpoint(endpoint);
10BcmClient bcmClient = new BcmClient(config);
11// request params definition
12List<Dimension> dimensions = new ArrayList<Dimension>();
13Dimension dimension = new Dimension();
14dimension.setName("BlbPortType");
15dimension.setValue("TCP");
16dimensions.add(dimension);
17List<String> statistics = new ArrayList<String>();
18statistics.add("sum");
19PartialDimensionsMetricsRequest request = new PartialDimensionsMetricsRequest();
20request.setScope("BCE_BLB");
21request.setUserId(userId);
22request.setMetricName("ActiveConnCount");
23request.setDimensions(dimensions);
24request.setRegion("bj");
25request.setStatistics(statistics);
26request.setStartTime("2024-03-20T02:21:17Z");
27request.setEndTime("2024-03-20T03:21:17Z");
28request.setResourceType("Blb");
29request.setPageNo(1);
30request.setPageSize(1);
31TsdbMetricResult<PageResultResponse<TsdbMetricAllDataResult.AllDataMetric>> result = bcmClient.getMetricsByPartialDimensions(request);
Response example
JSON
1{
2 "metadata": {
3 "bceRequestId": "bfdb5d91-39e6-4c35-aa73-caf76ad3440f",
4 "transferEncoding": "chunked",
5 "contentLength": -1,
6 "contentType": "application/json;charset=UTF-8",
7 "date": 1713138814000
8 },
9 "requestId": "bfdb5d91-39e6-4c35-aa73-caf76ad3440f",
10 "code": "success",
11 "message": "",
12 "result": {
13 "pageNo": 1,
14 "pageSize": 1,
15 "totalCount": 66,
16 "result": [{
17 "region": "bj",
18 "scope": "BCE_BLB",
19 "userId": "a0d04d7c***************7b6752ce4",
20 "resourceId": "lb-****8446",
21 "metricName": "ActiveConnCount",
22 "dimensions": [{
23 "name": "BlbId",
24 "value": "lb-****8446"
25 }, {
26 "name": "BlbPort",
27 "value": "3306"
28 }, {
29 "name": "BlbPortType",
30 "value": "TCP"
31 }],
32 "dataPoints": [{
33 "sum": 0.0,
34 "timestamp": "2024-03-20T02:21:17Z"
35 }, {
36 "sum": 0.0,
37 "timestamp": "2024-03-20T02:22:17Z"
38 },
39 // Intermediate points omitted
40 {
41 "sum": 0.0,
42 "timestamp": "2024-03-20T03:19:17Z"
43 }, {
44 "sum": 0.0,
45 "timestamp": "2024-03-20T03:20:17Z"
46 }, {
47 "timestamp": "2024-03-20T03:21:17Z"
48 }]
49 }]
50 }
51}
