跳到主要内容

查看集群指标

Queries the metrics of a cluster.

POST
/v1/clusters/{CLUSTER_ID}/metrics/query
Base URL

该 API 的 Base URL 格式如下:

https://controller.api.${CLOUD_REGION}.zilliz.com.cn

📘说明
export CLOUD_REGION="ali-cn-hangzhou"
export BASE_URL="https://controller.api.${CLOUD_REGION}.zilliz.com.cn"
参数
Authorizationstringheaderrequired

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

示例值:Bearer {{TOKEN}}
CLUSTER_IDstringpathrequired

The ID of the cluster.

示例值:inxx-xxxxxxxxxxxxxxxxx
请求体application/json
startstring必填项

开始时间,格式为 ISO 8601 时间戳格式(UTC)。当 period 参数未设置时,需要包含此参数。

示例值:2023-12-31T23:59:59Z
endstring必填项

结束时间,格式为 ISO 8601 时间戳格式(UTC)。当 period 参数未设置时,需要包含此参数。

示例值:2024-07-01T08:15:30Z
periodstring必填项

指标报告期间的持续时间,格式为 ISO 8601 持续时间格式(UTC)。当 startend 参数都未设置时,需要包含此参数。

granularitystring必填项

系统向用户报告指标的时间间隔,格式为 ISO 8601 持续时间格式(UTC)。最小粒度为 PT30S。

metricQueriesarrayrequired

指标查询对象数组。

[]metricQueriesobjectrequired

The information about the metric.

namestring必填项

待查询的指标名称。有关可用指标的详细信息,请参阅指标与告警快速参考

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"
}
]
}
]
}
}