查询实例监控指标趋势
更新时间:2026-09-22
该接口用于根据查询表达式、开始时间、结束时间和查询步长,查询指定 AI 网关实例在相应时间范围内的监控指标趋势数据。
注意事项:
- 实例必须已开启指标监控。
- 查询步长用于控制时间序列数据点的采样间隔。
请求结构
Plain Text
1POST /?action=DescribeRangeMetric HTTP/1.1
2Host: apigw-control.bj.baidubce.com
3Authorization: authorization string
4
5{
6 "instanceId": instanceId,
7 "query": query,
8 "step": step,
9 "start": start,
10 "end": end
11}
请求头域
除公共头域外,无其它特殊头域。
请求参数
| 参数名称 | 类型 | 是否必需 | 参数位置 | 描述 |
|---|---|---|---|---|
| instanceId | String | 是 | RequestBody参数 | 网关实例 ID |
| query | String | 是 | RequestBody参数 | 查询条件 |
| step | String | 是 | RequestBody参数 | 查询步长 |
| start | String | 是 | RequestBody参数 | 开始时间 |
| end | String | 是 | RequestBody参数 | 结束时间 |
返回头域
除公共头域,无其它特殊头域。
返回参数
| 参数名称 | 类型 | 描述 |
|---|---|---|
| status | String | 查询状态 |
| data | Object | 查询结果 |
| isPartial | String | 是否为部分结果 |
错误码
| 错误码 | 错误描述 | HTTP状态码 | 中文解释 |
|---|---|---|---|
| MethodArgumentNotValidException | MethodArgumentNotValidException: instanceId must not be blank | 400 | 必填参数缺失或格式不合法,instanceId 不能为空 |
| HttpMessageNotReadable | Http Message Not Readable: JSON parse error | 400 | 请求体不是合法 JSON,无法解析,请检查 JSON 语法和字段类型 |
| NotEnabledMetric | The instance has not enabled metric. | 400 | 实例未开启指标监控,请先开启 |
| ResourcePermissionDeny | Resource permission deny. | 401 | 无权限访问指定资源,请确认使用正确的账号凭证且资源属于当前账号 |
| InstanceNotExist | Instance not exist. | 404 | 实例不存在、不属于当前账号或已释放 |
| HttpMediaTypeException | HttpMediaTypeException: Content-Type 'text/plain' is not supported | 415 | 请求的 Content-Type 不受支持,请使用 application/json |
请求示例
Plain Text
1POST /?action=DescribeRangeMetric HTTP/1.1
2Host: apigw-control.bj.baidubce.com
3Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
4
5{
6 "instanceId": "gw-a1b2c3d4",
7 "query": "aigw_requests_total",
8 "step": "60",
9 "start": "1757145600",
10 "end": "1757232000"
11}
返回示例
Plain Text
1HTTP/1.1 200 OK
2x-bce-request-id: 1214cca7-4ad5-451d-9215-71cb844c0a50
3Date: Wed, 03 Dec 2014 06:42:19 GMT
4Content-Type: application/json;charset=UTF-8
5Server: BWS
6
7{
8 "status": "success",
9 "data": {
10 "resultType": "matrix",
11 "result": [
12 {
13 "metric": {
14 "__name__": "aigw_requests_total"
15 },
16 "values": [
17 [
18 1757145600,
19 "100"
20 ],
21 [
22 1757145660,
23 "105"
24 ],
25 [
26 1757145720,
27 "98"
28 ]
29 ]
30 }
31 ]
32 },
33 "isPartial": "false"
34}
评价此篇文章
