All Products
Search
Document Center

MaxCompute:QueryTunnelMetric

Last Updated:Oct 22, 2025

Queries metric data for the Tunnel Data Transmission Service within a specified time range.

Operation description

  • You can use this API to query various Tunnel metrics, such as slot usage (slot_usage), slot usage limit (slot_max), throughput (throughput), throughput rate (throughput_speed), and number of requests (request).

  • The startTime and endTime parameters are required. They specify the start and end of the time range for the query. The values are UNIX timestamps in seconds.

  • The metric parameter is also required. It specifies the type of metric to query.

  • Depending on the value of metric, you may need to specify additional parameters for filtering to refine your query. These parameters include quotaNickname, project, tableList, operationList, codeList, groupList, and topN.

  • For some metric values, you must specify other parameters. For example, if groupList contains table or ip, you must specify the project parameter and other required parameters. In this case, the system returns only the top N results.

  • The strategy parameter defines the data aggregation logic. This logic is used when the automatic step size exceeds 60 seconds over a long time range. The default value is max.

  • Ensure all parameters meet the requirements in this document to prevent request failures.

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:QueryTunnelMetric

list

*Tunnel

acs:odps:{#regionId}:{#accountId}:tunnel/{#metric}

None

None

Request syntax

POST /api/v1/observations/tunnel/{metric} HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

metric

string

Yes

The name of the metric.

Valid values:

  • request :

    request

  • slot_max :

    slot_max

  • slot_usage :

    slot_usage

  • throughput :

    throughput

  • throughput_speed :

    throughput_speed

slot_usage

Request parameters

Parameter

Type

Required

Description

Example

startTime

integer

Yes

The start of the time range for the query.

1735534322

endTime

integer

Yes

The end of the time range for the query.

1735536322

strategy

string

No

The data aggregation policy. The default value is max.

Data is collected at a frequency of 1 minute. If you query data over a long time range, the automatic step size for data display may exceed 1 minute. In this case, metrics are aggregated. This parameter specifies the aggregation logic.

Valid values:

  • avg :

    avg

  • max :

    max

max

body

object

No

The request body parameters.

quotaNickname

string

No

The nickname of the level-2 Tunnel quota.

The nickname of a shared quota is default.

The format of a dedicated quota nickname is quotaNickname#subQuotaNickname.

default

project

string

No

The name of the project.

project_a

tableList

array

No

A list of table names.

The tables belong to a project. Therefore, if tableList is not empty, project cannot be empty.

string

No

The name of the table.

tab_name

operationList

array

No

A list of operation types.

string

No

The operation type. Valid values include the following:

upload: Tunnel batch upload

download: Tunnel batch download

stream_upload: Tunnel stream upload

max_storage_read: Storage API download

download_instance: Tunnel instance download

upsert: Tunnel upsert upload

max_storage_write: Storage API upload

table_preview: Preview download

Valid values:

  • download :

    download

  • max_storage_read :

    max_storage_read

  • max_storage_write :

    max_storage_write

  • upload :

    upload

  • upsert :

    upsert

  • table_preview :

    table_preview

  • download_instance :

    download_instance

  • stream_upload :

    stream_upload

upload

codeList

array

No

A list of HTTP status codes for requests.

integer

No

An HTTP status code.

403

groupList

array

No

A list of grouping criteria.

string

No

The grouping criterion. Valid values include the following:

quota

project

table

operation

ip (Supported only when metric is throughput)

code (Supported only when metric is request)

quota

topN

integer

No

The maximum number of data entries to return.

This parameter takes effect when the grouping criterion includes table or ip.

The default value is 10. The maximum value is 100.

10

slot_usage

  • Description: Slot usage.

  • Supported optional filtering parameters: quotaNickname, project, tableList, operationList, groupList, and topN.

    • At least one of quotaNickname or project must be specified.

    • The tableList and topN parameters are applicable only if project is specified and groupList contains table.

  • Supported groupList values: quota, project, table, and operation.

    • You must specify groupList. This parameter specifies the granularity of the data display.

    • If quotaNickname is set to default, groupList must contain project. This is because shared quotas are at the project level.

    • If groupList contains table, you must specify the project parameter. The system then returns only the top N time series data.

slot_max

  • Description: Slot usage limit.

  • The quotaNickname parameter is required.

    • If quotaNickname is set to default, you must specify the project parameter. This is because shared quotas are at the project level.

  • Supported groupList values: quota and project.

throughput

  • Description: Throughput.

  • Supported optional filtering parameters: quotaNickname, project, tableList, operationList, groupList, and topN.

    • At least one of quotaNickname or project must be specified.

    • The tableList and topN parameters are applicable only if project is specified and groupList contains table or ip.

  • Supported groupList values: quota, project, table, ip, and operation.

    • You must specify groupList. This parameter specifies the granularity of the data display.

    • If groupList contains table, you must specify the project parameter. The system then returns only the top N time series data.

    • If groupList contains ip, you must specify the project and tableList parameters. The system then returns only the top N time series data.

throughput_speed

  • Description: Throughput rate.

  • Supported optional filtering parameters: quotaNickname, project, tableList, operationList, groupList, and topN.

    • At least one of quotaNickname or project must be specified.

    • The tableList and topN parameters are applicable only if project is specified and groupList contains table.

  • Supported groupList values: quota, project, table, and operation.

    • You must specify groupList. This parameter specifies the granularity of the data display.

    • If groupList contains table, you must specify the project parameter. The system then returns only the top N time series data.

request

  • Description: Number of requests.

  • Supported optional filtering parameters: quotaNickname, project, tableList, operationList, codeList, groupList, and topN.

    • At least one of quotaNickname or project must be specified.

    • The tableList and topN parameters are applicable only if `project` is specified and groupList contains table.

  • Supported groupList values: quota, project, table, operation, and code.

    • You must specify groupList. This parameter specifies the granularity of the data display.

    • If groupList contains table, you must specify the project parameter. The system then returns only the top N time series data.

Response elements

Element

Type

Description

Example

object

PopResult

requestId

string

The request ID.

0bc3b4b016674434996033675e71ee

httpCode

integer

Indicates whether the operation was successful. If this parameter is not empty and the value is not 200, the operation failed.

200

errorCode

string

The error code.

success

errorMsg

string

The error message.

0A3B1E82006A23A918C70905BF08AEC7

data

object

The returned data.

category

string

The category of the metric.

tunnel

name

string

The name of the metric.

slot_usage

period

integer

The step size of the monitoring data.

60

metrics

array<object>

The metric values.

object

A metric value.

metric

object

The metadata of the metric.

string

The metadata. The key is the grouping criterion, and the value is the corresponding metadata.

"project":"prjName"

values

array

A list of metric values.

array

An array of two elements: a timestamp and a value.

number

The timestamp and the metric value.

[1745220780,1]

Examples

Success response

JSON format

{
  "requestId": "0bc3b4b016674434996033675e71ee",
  "httpCode": 200,
  "errorCode": "success",
  "errorMsg": "0A3B1E82006A23A918C70905BF08AEC7",
  "data": {
    "category": "tunnel",
    "name": "slot_usage",
    "period": 60,
    "metrics": [
      {
        "metric": {
          "key": "\"project\":\"prjName\""
        },
        "values": [
          [
            0
          ]
        ]
      }
    ]
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.