查看集群指标 (V1)即将作废
Queries the metrics of a cluster.
POST
  /v1/clusters/{CLUSTER_ID}/metrics/query该 API 的 Base URL 格式如下:
https://controller.api.${CLOUD_REGION}.zilliz.com.cn
📘说明
- 你需要将 
${CLOUD_REGION}替换为您的集群所在区域。 - 获取云区域 ID 请参考 Zilliz Cloud 控制台 或使用查看云区域接口。
 
export CLOUD_REGION="ali-cn-hangzhou"
export BASE_URL="https://controller.api.${CLOUD_REGION}.zilliz.com.cn"
参数
Authorizationstringheaderrequired
认证令牌,应为具备适当权限的 API 密钥。
示例值:Bearer {{TOKEN}}
CLUSTER_IDstringpathrequired
集群 ID。
示例值:inxx-xxxxxxxxxxxxxxxxx
请求体application/json
startstring必填项
开始时间,格式为 ISO 8601 时间戳格式(UTC)。当 period 参数未设置时,需要包含此参数。
示例值:2023-12-31T23:59:59Z
endstring必填项
结束时间,格式为 ISO 8601 时间戳格式(UTC)。当 period 参数未设置时,需要包含此参数。
示例值:2024-07-01T08:15:30Z
granularitystring必填项
系统向用户报告指标的时间间隔,格式为 ISO 8601 持续时间格式(UTC)。最小粒度为 PT30S。
metricQueriesarrayrequired
指标查询对象数组。
[]metricQueriesobjectrequired
The information about the metric.
statstring必填项
用于对指标进行统计的方法。AVG 表示计算平均值,对所有指标都适用; P99 表示计算 99 百分位值,对时延相关指标适用。
export TOKEN="YOUR_API_KEY"
export CLUSTER_ID="inxx-xxxxxxxxxxxxxxxxx"
curl --request POST \
--url "${BASE_URL}/v1/clusters/${CLUSTER_ID}/metrics/query" \
--header "Authorization: Bearer ${TOKEN}" \
--header "Content-Type: application/json" \
-d '{
    "start": "",
    "end": "",
    "period": "PT99H",
    "granularity": "PT5H",
    "metricQueries": [
        {
            "name": "CU_CAPACITY",
            "stat": "AVG"
        }
    ]
}'
响应200  - application/json
A success response.
codeinteger
响应码。
dataobject
响应负载,是一个包含查询指标信息的对象。
resultsarray
结果对象数组。
[]resultsobject
Information about the metric.
namestring
指标名称。
statstring
用于计算指标的统计方法。
unitstring
指标的计量单位,如百分比。
valuesarray
一组数据点。
[]valuesobject
A data point in detail.
timestampstring
数据点的时间戳,格式为 ISO 8601。
valuestring
指标在给定时间戳的值。
A failure response.
codeinteger
响应码。
messagestring
错误描述。
{
    "code": 200,
    "data": {
        "results": [
            {
                "name": "CU_COMPUTATION",
                "stat": "AVG",
                "unit": "percent",
                "values": [
                    {
                        "timestamp": "2024-07-23T16:09:53Z",
                        "value": "1.00"
                    },
                    {
                        "timestamp": "2024-07-23T22:09:53Z",
                        "value": "1.00"
                    },
                    {
                        "timestamp": "2024-07-24T04:09:53Z",
                        "value": "1.00"
                    }
                ]
            }
        ]
    }
}