跳到主要内容

查询集群指标 (V2)

本接口可以查询指定集群的统计指标。

POST/v2/clusters/{CLUSTER_ID}/metrics/query
连接端点

该 API 的 Base URL 格式如下:

https://api.cloud.zilliz.com

📘说明

控制面接口速率限制为单用户单接口每秒最多 20 个请求。

shell
export BASE_URL="https://api.cloud.zilliz.com"
参数
Authorizationstringheader必填项

认证令牌,应为具备适当权限的 API 密钥。

示例值:Bearer {{TOKEN}}
CLUSTER_IDstringpath必填项

目标集群的 ID。

示例值:inxx-xxxxxxxxxxxxxxx
请求体
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。

dbNamestring

目标 Database 名称。

collectionNamestring

目标 Collection 名称。

metricQueriesarray必填项

一个 MetricQuery 对象列表。

[]metricQueriesobject必填项

一个 MetricQuery 对象。

namestring必填项

指标名称。
可选值请参考枚举。
关于这些指标的详细信息,请参考指标与告警参考章节。

bash
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 "Request-Timeout: 5" \
--header "Content-Type: application/json" \
-d '{
"start": "2024-06-30T16:09:53Z",
"end": "2024-07-01T16:09:53Z",
"granularity": "PT6H",
"metricQueries": [
{
"name": "CU_COMPUTATION"
}
]
}'
响应

返回指定指标的相关统计信息。

codeinteger

响应码。

dataobject

响应负载。

resultsarray

对指定指标采集到的统计信息列表。

[]resultsobject

采集到的统计信息。

namestring

指标名称。

unitstring

统计值单位。

valuesarray

在采集周期内收集到的统计信息列表。

[]valuesobject

在采集周期内收集到的统计信息。

timestampstring

ISO 8601 格式的数据点时间戳。

valuestring

给定时间戳的指标值。

返回错误消息。

codeinteger

响应码。

messagestring

错误描述。

Successjson
{
"code": 0,
"data": {
"results": [
{
"name": "CU_COMPUTATION",
"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"
}
]
}
]
}
}