GetMetrics

更新时间:
复制 MD 格式

Retrieve metrics data.

Operation description

Request description

  • This API retrieves monitoring metrics for a specific job (JobId) or dimensions under a given namespace.

  • It supports custom time ranges. By default, it returns data from the last hour.

  • Select different time intervals (Period) to obtain data points with finer or coarser granularity.

  • To paginate through large datasets, use the NextToken parameter.

  • The MetricName parameter is required and specifies the monitoring metric to query.

  • For advanced features or specific metric types, see the related documentation.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request syntax

GET /api/v1/cms/metrics HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

Namespace

string

No

The namespace for cloud service monitoring data. For more information about namespaces, see cloud service monitoring metrics.

acs_pai_dlc

JobId

string

No

The job ID.

dlckjd5hm84tmjec

Dimensions

string

No

(Required) Request parameter.

[{\"jobId\":\"dlcdpfpc96mh63mg\",\"pod\":\"dlcdpfpc96mh63mg-worker-748\",\"regionId\":\"cn-wulanchabu\",\"userId\":\"1458867964644701\"}]

Length

string

No

The number of records per query for paged queries. Default value: 1000.

5000

EndTime

string

No

The end time of the query. Default value: current time.

2020-11-09T16:00:00Z

Period

string

No

The statistical period for monitoring data. Unit: seconds. Valid values: 15, 60, 900, and 3600.

5

NextToken

string

No

The pagination cursor token. If you do not set this parameter, the first page of data is returned. When a NextToken value is returned, more data is available. Use the returned NextToken as a parameter in your next request to retrieve the next page. Repeat until NextToken returns null, which means all data has been retrieved.

2c6b65b6f9d625d4716568ca19b2064be0b5e8707e68181f

MetricName

string

No

Metric name. Not filled. Not in use.

JOB_MEMORY_FREE

StartTime

string

No

The start time of the monitoring data query interval (UTC). Default value: one hour ago.

2020-11-08T16:00:00Z

Token

string

No

A 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 succeeded. Valid values: true (success) and false (failure).

True

DataPoints

string

The monitoring metric data.

[{'Content': '', 'OperationName': 'purchase', 'Success': 1, 'Id': '217', 'LogDatetime': 1687679582923}]

Code

string

The status code. A value of 200 indicates success.

200

Message

string

Detailed result message.

Success.

Period

string

The statistical period for monitoring data. Valid values: 15, 60, 900, and 3600. Unit: seconds. If you do not specify a statistical period, the system uses the reporting period registered for the metric. Each cloud service metric (MetricName) may have a different statistical period. 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.