GetMetrics
Retrieves metrics data.
Operation description
Request description
This operation queries the monitoring metrics for a specific job (JobId) or dimension (Dimensions) under a specified namespace.
Supports a custom query time range. The default is the data from the last hour.
You can select different time intervals (Period) to obtain data points with finer or coarser granularity.
If you need to retrieve a large amount of data through paging, you can use the
NextTokenparameter for paging.MetricNameis required and specifies the name of the specific monitoring metrics to query.For advanced features or specific types of monitoring metrics, refer to the relevant documentation for more information.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
paidlc:GetMetrics |
none |
*All Resource
|
None | None |
Request syntax
GET /api/v1/cms/metrics HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| Namespace |
string |
No |
The data namespace of the cloud service. For more information about the data namespaces of cloud services, see Cloud service monitoring metrics. |
acs_pai_dlc |
| JobId |
string |
No |
The job ID. |
dlckjd5hm84tmjec |
| Dimensions |
string |
No |
(Required) The request parameters. |
[{\"jobId\":\"dlcdpfpc96mh63mg\",\"pod\":\"dlcdpfpc96mh63mg-worker-748\",\"regionId\":\"cn-wulanchabu\",\"userId\":\"1458867964644701\"}] |
| Length |
string |
No |
The size of each query, used for paging queries. Default value: 1000. |
5000 |
| EndTime |
string |
No |
The end time of the query. Default value: the current time. |
2020-11-09T16:00:00Z |
| Period |
string |
No |
The statistical period of the monitoring data. Unit: seconds. Valid values: 15, 60, 900, and 3600. |
5 |
| NextToken |
string |
No |
The pagination cursor. If this parameter is not specified, the first page of data is returned. If this parameter is returned in the response, it indicates that more data is available. You can use the returned NextToken value as the parameter in the next request to retrieve the next page of data until the returned value is null, which indicates that all data has been retrieved. |
2c6b65b6f9d625d4716568ca19b2064be0b5e8707e68181f |
| MetricName |
string |
No |
The metric name. This parameter is unpopulated and not in use. |
JOB_MEMORY_FREE |
| StartTime |
string |
No |
The start time of the time range for querying monitoring data in UTC. Default value: 1 hour ago. |
2020-11-08T16:00:00Z |
| Token |
string |
No |
The temporary token used for authentication. |
eyXXXX-XXXX.XXXXX |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| NextToken |
string |
Id of the request |
AAAAAV3MpHK1AP0pfERHZN5pu6lESTRpd5hnHNnmKOP/+w9F |
| Success |
boolean |
Indicates whether the operation was successful. Valid values: true: The operation was successful. false: The operation failed. |
True |
| DataPoints |
string |
The monitoring metrics data. |
[{'Content': '', 'OperationName': 'purchase', 'Success': 1, 'Id': '217', 'LogDatetime': 1687679582923}] |
| Code |
string |
The status code. A value of 200 indicates success. |
200 |
| Message |
string |
The detailed information about the detection result. |
Success. |
| Period |
string |
The statistical period of the monitoring data. Valid values: 15, 60, 900, and 3600. Unit: seconds. If the statistical period is not specified, the monitoring data is queried based on the reporting period applied for when the monitoring metric was registered. The statistical period varies with the monitoring metric (MetricName) of each cloud service. For more information, see Cloud service monitoring metrics. |
5 |
| RequestId |
string |
The request ID. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
Examples
Success response
JSON format
{
"NextToken": "AAAAAV3MpHK1AP0pfERHZN5pu6lESTRpd5hnHNnmKOP/+w9F",
"Success": true,
"DataPoints": "[{'Content': '', 'OperationName': 'purchase', 'Success': 1, 'Id': '217', 'LogDatetime': 1687679582923}]",
"Code": "200",
"Message": "Success.",
"Period": "5",
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.