All Products
Search
Document Center

MaxCompute:ListComputeMetricsByInstance

Last Updated:Apr 16, 2026

Lists the compute usage for jobs per instance.

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

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

odps:ListComputeMetricsByInstance

list

*All Resource

*

None None

Request syntax

POST /api/v1/computeMetrics/listByInstance HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

body

object

No

The request body.

projectNames

array

No

The names of the projects.

string

No

The name of a project.

odps_porject

startDate

integer

No

The start of the query time range, specified as a UNIX timestamp in milliseconds.

1715393576201

endDate

integer

No

The end of the query time range, specified as a UNIX timestamp in milliseconds.

1718590596556

instanceId

string

No

The instance ID.

20240730****ddlr

jobOwner

string

No

The job owner.

ALIYUN$7632***@aliyun.com

signature

string

No

The SQL job signature.

ghijkl789012

pageNumber

integer

No

The page number.

1

pageSize

integer

No

The number of entries per page. The default value is 10.

10

types

array

No

The metering types.

string

No

The metering type. Valid values:

  • ComputationSql: Metering data for SQL jobs on internal tables.

  • ComputationSqlOTS: Metering data for SQL jobs on Tablestore external tables.

  • ComputationSqlOSS: Metering data for SQL jobs on OSS external tables.

  • MapReduce: Metering data for MapReduce jobs.

  • Spark: Metering data for Spark jobs.

  • Mars: Metering data for Mars jobs.

SQL

specCodes

array

No

The specification types.

string

No

The specification type. Valid values:

  • OdpsStandard: Pay-as-you-go standard edition.

  • OdpsSpot: Pay-as-you-go spot edition.

OdpsStandard

Response elements

Element

Type

Description

Example

object

The data returned. Example: { "data":{ "instanceComputeMetrics":[ { "unit":"GBCplx", "instanceId":"20260415082755g4af3vobxio", "submitTime":1776241680, "specCode":"OdpsStandard", "signature":"4c504210645f7850cf847c17886bf", "usage":0.8054948877543211, "jobOwner":"RAM$1393348188455728:role/aliyunservicerolefomputemms", "endTime":1776241682, "type":"ComputationSql", "projectName":"dbs_mc" }, { "unit":"GBCplx", "instanceId":"202604150828258gv9abz7unq14", "submitTime":1776241707, "specCode":"OdpsStandard", "signature":"cacb1e31deb**c19e515b59634a", "usage":0.1720797186717391, "jobOwner":"ALIYUN$mc_ma_testcloud_com", "endTime":1776241707, "type":"ComputationSql", "projectName":"webui_139728_hangzhou" } ], "pageNumber":1, "pageSize":10, "totalCount":2808 }, "requestId":"0adb99df17763408113761151d0001" }

requestId

string

The request ID.

0bc059b717363029839908920ea631

httpCode

integer

The HTTP status code.

  • 1xx: Informational - The request has been received and is being processed.

  • 2xx: Success - The request was successfully received, understood, and accepted.

  • 3xx: Redirection - Further action is required to complete the request.

  • 4xx: Client Error - The request contains invalid syntax or cannot be fulfilled.

  • 5xx: Server Error - The server failed to fulfill a valid request.

200

data

object

The data returned.

instanceComputeMetrics

array<object>

Usage metrics for pay-as-you-go jobs.

object

instanceId

string

The instance ID.

20240730****ddlr

type

string

The metering type.

  • ComputationSql: Metrics for SQL jobs on internal tables.

  • ComputationSqlOTS: Metrics for SQL jobs on Tablestore external tables.

  • ComputationSqlOSS: Metrics for SQL jobs on OSS external tables.

  • MapReduce: Metrics for MapReduce jobs.

  • spark: Metrics for Spark jobs.

  • mars: Metrics for Mars jobs.

ComputationSql

specCode

string

The specification type.

  • OdpsStandard: Standard pay-as-you-go specification.

  • OdpsSpot: Spot pay-as-you-go specification.

OdpsStandard

jobOwner

string

The owner of the job.

ALIYUN$7632***@aliyun.com

projectName

string

The name of the project.

odps_porject

submitTime

integer

The job submission time, as a UNIX timestamp in milliseconds.

1610432000000

endTime

integer

The job completion time, as a UNIX timestamp in milliseconds.

1710432000000

signature

string

The signature of the SQL job.

pqrs12345tuv

usage

number

The compute usage.

  • For jobs billed by the amount of data scanned, such as ComputationSql, ComputationSqlOTS, and ComputationSqlOSS jobs, the unit is GB. The usage is calculated as: Amount of scanned data × Complexity. The complexity factor for ComputationSqlOTS and ComputationSqlOSS jobs is 1.

  • For jobs billed by CU-hours (such as MapReduce, spark, and mars jobs), the unit is CU-hour.

1024

unit

string

The unit of compute usage.

GB

totalCount

integer

The total number of entries returned.

64

pageNumber

integer

The returned page number.

1

pageSize

integer

The number of entries per page.

10

Examples

Success response

JSON format

{
  "requestId": "0bc059b717363029839908920ea631",
  "httpCode": 200,
  "data": {
    "instanceComputeMetrics": [
      {
        "instanceId": "20240730****ddlr",
        "type": "ComputationSql",
        "specCode": "OdpsStandard",
        "jobOwner": "ALIYUN$7632***@aliyun.com",
        "projectName": "odps_porject",
        "submitTime": 1610432000000,
        "endTime": 1710432000000,
        "signature": "pqrs12345tuv",
        "usage": 1024,
        "unit": "GB"
      }
    ],
    "totalCount": 64,
    "pageNumber": 1,
    "pageSize": 10
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.