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
startTimeandendTimeparameters are required. They specify the start and end of the time range for the query. The values are UNIX timestamps in seconds.The
metricparameter 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 includequotaNickname,project,tableList,operationList,codeList,groupList, andtopN.For some
metricvalues, you must specify other parameters. For example, ifgroupListcontainstableorip, you must specify theprojectparameter and other required parameters. In this case, the system returns only the top N results.The
strategyparameter 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 ismax.Ensure all parameters meet the requirements in this document to prevent request failures.
Try it now
Test
RAM authorization
Action | Access level | Resource type | Condition key | Dependent action |
odps:QueryTunnelMetric | list | *Tunnel
| None | None |
Request syntax
POST /api/v1/observations/tunnel/{metric} HTTP/1.1Path Parameters
Parameter | Type | Required | Description | Example |
metric | string | Yes | The name of the metric. Valid values:
| 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 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:
| 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 The format of a dedicated quota nickname is | 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 | |
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:
| 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 code (Supported only when | quota | |
topN | integer | No | The maximum number of data entries to return. This parameter takes effect when the grouping criterion includes 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
quotaNicknameorprojectmust be specified.The
tableListandtopNparameters are applicable only ifprojectis specified andgroupListcontainstable.
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
quotaNicknameorprojectmust be specified.The
tableListandtopNparameters are applicable only ifprojectis specified andgroupListcontainstableor 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
quotaNicknameorprojectmust be specified.The
tableListandtopNparameters are applicable only ifprojectis specified andgroupListcontainstable.
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
quotaNicknameorprojectmust be specified.The
tableListandtopNparameters are applicable only if `project` is specified andgroupListcontainstable.
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.