全部產品
Search
文件中心

MaxCompute:QueryTunnelMetric - Tunnel資源觀測時序資料

更新時間:Oct 11, 2025

用於查詢指定時間範圍內的TunnelData Transmission Service相關指標資料。

介面說明

請求說明

  • 本 API 支援查詢包括 slot 使用量(slot_usage)、slot 使用上限(slot_max)、輸送量(throughput)、輸送量速率(throughput_speed)以及請求數(request)等在內的多種 Tunnel 指標。

  • startTimeendTime為必選參數,分別代表查詢的時間段起始和結束時間戳記(秒)。

  • metric參數也是必需的,用來指定要查詢的具體指標類型。

  • 根據不同的metric值,可能需要提供額外的過濾參數如quotaNickname, project, tableList, operationList, codeList, groupListtopN等來進一步細化查詢條件。

  • 特別注意的是,對於某些特定的metric(例如當groupList包含tableip時),必須同時指定相關的專案(project)和其他必要參數,並且系統會強制返回 Top N 的結果。

  • 參數strategy定義了在較長時間範圍內資料自適應步長超過 60 秒時的資料彙總邏輯,預設為max

  • 確保所有提供的參數符合文檔中列出的要求以避免請求失敗。

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

odps:QueryTunnelMetric

list

*Tunnel

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

請求文法

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

路徑參數

名稱

類型

必填

描述

樣本值

metric

string

觀測指標名稱。

枚舉值:

  • request :

    request

  • slot_max :

    slot_max

  • slot_usage :

    slot_usage

  • throughput :

    throughput

  • throughput_speed :

    throughput_speed

slot_usage

請求參數

名稱

類型

必填

描述

樣本值

startTime

integer

查詢時間範圍:開始時間。

1735534322

endTime

integer

查詢時間範圍:結束時間。

1735536322

strategy

string

資料彙總策略。預設 max。

資料的採集頻率是 1 分鐘。當查詢的時間範圍較大時,資料展示的自適應步長會超過 1 分鐘,此時指標會進行彙總。該參數即指定資料的彙總邏輯。

枚舉值:

  • avg :

    avg

  • max :

    max

max

body

object

請求體參數。

quotaNickname

string

Tunnel 二級 Quota 暱稱。

共用 Quota 暱稱是:default

獨享 Quota 暱稱的格式是:quotaNickname#subQuotaNickname

default

project

string

專案名稱。

project_a

tableList

array

表名稱列表

歸屬於 project,因此如果 tableList 不為空白,則 project 不為空白。

string

表名稱

tab_name

operationList

array

操作類型列表

string

操作類型|包括:

upload - Tunnel Batch 上傳

download - Tunnel Batch 下載

stream_upload - Tunnel Stream 上傳

max_storage_read - Storage API 下載

download_instance - Tunnel Instance 下載

upsert - Tunnel Upsert 上傳

max_storage_write - Storage API 上傳

table_preview - Preview 下載

枚舉值:

  • 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

請求的 HTTP CODE 列表

integer

HTTP CODE

403

groupList

array

分組依據列表

string

分組依據。包括:

quota

project

table

operation

ip (僅 metric 為 throughput 時支援)

code (僅 metric 為 request 時支援)

quota

topN

integer

資料數量限制。

當分組依據包含 table 或 ip 時,該參數生效。

預設是 10,最大不超過 100。

10

slot_usage

  • slot 使用量

  • 支援可選過濾參數:quotaNickname,project,tableList,operationList,groupList,topN
    • quotaNickname 和 project 不能同時為空白

    • tableList 和 topN 僅在指定 project 且 groupList 包含 table 時生效。

  • groupList 支援 quota,project,table,operation。
    • groupList 不可為空,表示資料的展示粒度。

    • 當 quotaNickname=default 時,groupList 必須包含 project。(因為共用 quota 是 project 層級的)

    • 當 groupList 包含 table 時,必須指定 project 參數。此時,系統強制返回 TopN 的時序資料。

slot_max

  • slot 使用上限。

  • quotaNickname 必選。
    • 當 quotaNickname=default 時,必須指定 project 參數。(因為共用 quota 是 project 層級的)

  • groupList 只支援 quota,project

throughput

  • 輸送量

  • 支援可選過濾參數:quotaNickname,project,tableList,operationList,groupList,topN
    • quotaNickname 和 project 不能同時為空白

    • tableList 和 topN 僅在指定 project 且 groupList 包含 table 或 ip 時生效。

  • groupList 支援 quota,project,table,ip,operation
    • groupList 不可為空,表示資料的展示粒度。

    • 當 groupList 包含 table 時,必須指定 project 參數。此時,系統強制返回 TopN 的時序資料。

    • 當 groupList 包含 ip 時,必須指定 project 參數和 tableList 參數。此時,系統強制返回 TopN 的時序資料。

throughput_speed

  • 輸送量速率

  • 支援可選過濾參數:quotaNickname,project,tableList,operationList,groupList,topN
    • quotaNickname 和 project 不能同時為空白

    • tableList 和 topN 僅在指定 project 且 groupList 包含 table 時生效。

  • groupList 支援 quota,project,table,operation
    • groupList 不可為空,表示資料的展示粒度。

    • 當 groupList 包含 table 時,必須指定 project 參數。此時,系統強制返回 TopN 的時序資料。

request

  • 請求數

  • 支援可選過濾參數:quotaNickname,project,tableList,operationList,codeList,groupList,topN
    • quotaNickname 和 project 不能同時為空白

    • tableList 和 topN 僅在指定 project 且 groupList 包含 table 時生效。

  • groupList 支援 quota,project,table,operation,code
    • groupList 不可為空,表示資料的展示粒度。

    • 當 groupList 包含 table 時,必須指定 project 參數。此時,系統強制返回 TopN 的時序資料。

返回參數

名稱

類型

描述

樣本值

object

PopResult

requestId

string

請求 ID。

0bc3b4b016674434996033675e71ee

httpCode

integer

業務成功與否。如果非空且不是 200,那麼表示業務處理失敗。

200

errorCode

string

錯誤碼。

success

errorMsg

string

錯誤描述資訊。

0A3B1E82006A23A918C70905BF08AEC7

data

object

返回資料

category

string

觀測指標所屬類別。

tunnel

name

string

觀測指標名稱。

slot_usage

period

integer

監控資料步長。

60

metrics

array<object>

指標值。

object

指標值。

metric

object

指標中繼資料資訊。

string

中繼資料資訊。其中,key 是分組依據,value 是對應的中繼資料。

"project":"prjName"

values

array

指標數值列表。

array

長度為 2,分別是時間戳記和數值。

number

時間戳記和指標數值。

[1745220780,1]

樣本

正常返回樣本

JSON格式

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

錯誤碼

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情