查询集群指标
本接口可以查询指定集群的统计指标。
POST
/v2/clusters/{CLUSTER_ID}/metrics/query该 API 的 Base URL 格式如下:
https://api.cloud.zilliz.com.cn
📘说明
控制面接口速率限制为单用户单接口每秒最多 20 个请求。
export BASE_URL="https://api.cloud.zilliz.com.cn"
参数
Authorizationstringheaderrequired
认证令牌,应为具备适当权限的 API 密钥。
示例值:Bearer {{TOKEN}}
CLUSTER_IDstringpathrequired
ID of the target cluster.
示例值:inxx-xxxxxxxxxxxxxxx
请求体application/json
startstring
指标报告期间的起始日期和时间,以 UTC 时间格式的 ISO 8601 时间戳表示。当 period
参数未设置时,需同时包含 start
和 end
参数。
endstring
指标报告期间的结束日期和时间,以 UTC 时间格式的 ISO 8601 时间戳表示。当 period
参数未设置时,需同时包含 start
和 end
参数。
periodstring
Zilliz Cloud 向用户报告指标的持续时间,以 UTC 时间格式的 ISO 8601 持续时间表示。当 start
和 end
参数未设置时,需同时包含 period
参数。
granularitystring必填项
Zilliz Cloud 向用户报告指标的时间间隔,以 UTC 时间格式的 ISO 8601 持续时间表示。最小粒度为 PT30S。
metricQueriesarrayrequired
一个 MetricQuery 对象列表。
[]metricQueriesobjectrequired
A MetricQuery object.
statstring必填项
当前指标使用的统计方法。对于延迟指标,可选值为 AVG(平均值)和 P99(99百分位)。对于其他指标,AVG 均可使用。
export TOKEN="YOUR_API_KEY"
export CLUSTER_ID="inxx-xxxxxxxxxxxxxxx"
curl --request POST \
--url "${BASE_URL}/v2/clusters/${CLUSTER_ID}/metrics/query" \
--header "Authorization: Bearer ${TOKEN}" \
--header "Content-Type: application/json" \
-d '{
"start": "2024-06-30T16:09:53Z",
"end": "2024-07-01T16:09:53Z",
"granularity": "PT6H",
"metricQueries": [
{
"name": "CU_COMPUTATION",
"stat": "AVG"
}
]
}'
响应200 - application/json
codeinteger
响应码。
dataobject
响应负载。
resultsarray
对指定指标采集到的统计信息列表。
[]resultsobject
A set of collected statistics.
namestring
指标名称。
statstring
使用的统计方法。
unitstring
统计值单位。
valuesarray
在采集周期内收集到的统计信息列表。
[]valuesobject
Statistics collected within an interval period.
timestampstring
ISO 8601 格式的数据点时间戳。
valuestring
给定时间戳的指标值。
Returns an error message.
codeinteger
响应码。
messagestring
错误描述。
{
"code": 0,
"data": {
"results": [
{
"name": "CU_COMPUTATION",
"stat": "AVG",
"unit": "percent",
"values": [
{
"timestamp": "2024-06-30T16:09:53Z",
"value": null
},
{
"timestamp": "2024-06-30T22:09:53Z",
"value": "1.00"
},
{
"timestamp": "2024-07-01T04:09:53Z",
"value": "1.00"
},
{
"timestamp": "2024-07-01T10:09:53Z",
"value": "1.00"
}
]
}
]
}
}