查询API指标统计值 - ListStatisticsApi
功能介绍
查询某个实例下的API统计信息。
接口约束
调用超时或返回“request statistics error”报错时,请切换其他mode或缩短统计时长。
授权信息
账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限,具体权限要求请参见权限和授权项。
URI
GET /v2/{project_id}/apic/instances/{instance_id}/statistics/api
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
project_id | 是 | String | 项目ID,获取方式请参见API参考的“附录 > 获取项目ID”章节。 |
instance_id | 是 | String | 实例ID |
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
mode | 否 | String | 查询模式,默认为INSTANCE
注意:mode =APP或ALL时,接口响应中不返回cycle,api_id,group_id,provider,register_time,status字段 mode =INSTANCE时,若不填写api_id或roma_app_id,则要求主账号权限才能调用成功 |
roma_app_id | 否 | String | 集成应用编号,查询模式为APP时必填 |
api_id | 否 | String | API编号,查询模式为API时必填 |
cycle | 否 | String | 查询统计周期
例如,cycle=hour,duration=2h是指查询范围两小时以内,一小时一次数据采样,采样到的数据值为一小时内的累计值。 cycle=minute时,支持查询最近3小时的数据 cycle=hour时,支持查询最近3天的数据 cycle=day时,支持查询最近90天的数据 |
start_time | 否 | String | 开始时间,格式:2020-06-18 10:00:01 |
end_time | 否 | String | 结束时间,格式:2020-06-18 23:00:00 |
duration | 否 | String | 统计时长格式:整数+单位(m、h),m:分钟,h:小时,可支持小时与分钟的组合。例如:1h或2h45m
|
请求参数
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
X-Auth-Token | 是 | String | 用户Token。通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 |
响应参数
状态码:200
参数 | 参数类型 | 描述 |
|---|---|---|
code | String | 响应码 |
start_time | Long | 开始时间的UTC的时间戳 |
end_time | Long | 截止时间的UTC的时间戳 |
list | Array of StatisticsAPI objects | 统计指标的数据结构结构体 |
参数 | 参数类型 | 描述 |
|---|---|---|
max_latency | Integer | 最大延时 |
avg_latency | Float | 平均延时 |
req_count | Integer | 请求总次数 |
req_count2xx | Integer | 2xx响应码总次数 |
req_count4xx | Integer | 4xx响应码总次数 |
req_count5xx | Integer | 5xx响应码总次数 |
req_count_error | Integer | 错误次数 |
max_inner_latency | Integer | 最大网关内部延时 |
avg_inner_latency | Float | 平均网关内部延时 |
max_backend_latency | Integer | 最大后端延时 |
avg_backend_latency | Float | 平均后端延时 |
output_throughput | Long | 下行吞吐量(byte) |
input_throughput | Long | 上行吞吐量(byte) |
current_minute | Long | API访问的UTC时间戳 |
cycle | String | 查询统计周期 |
api_id | String | API编号 |
group_id | String | API分组编号 |
provider | String | API拥有者 |
req_time | String | API请求时间 |
register_time | String | 记录时间 |
status | Integer | 状态值:
预留字段,暂不支持 |
状态码:400
参数 | 参数类型 | 描述 |
|---|---|---|
error_code | String | 错误码 |
error_msg | String | 错误描述 |
状态码:401
参数 | 参数类型 | 描述 |
|---|---|---|
error_code | String | 错误码 |
error_msg | String | 错误描述 |
状态码:403
参数 | 参数类型 | 描述 |
|---|---|---|
error_code | String | 错误码 |
error_msg | String | 错误描述 |
状态码:404
参数 | 参数类型 | 描述 |
|---|---|---|
error_code | String | 错误码 |
error_msg | String | 错误描述 |
状态码:500
参数 | 参数类型 | 描述 |
|---|---|---|
error_code | String | 错误码 |
error_msg | String | 错误描述 |
请求示例
无
响应示例
状态码:200
OK
{
"code" : "APIG.0000",
"start_time" : 1599400383,
"end_time" : 1599616383,
"list" : [ {
"max_latency" : 0,
"avg_latency" : 0,
"max_inner_latency" : 0,
"avg_inner_latency" : 0,
"max_backend_latency" : 0,
"avg_backend_latency" : 0,
"req_count" : 5,
"req_count2xx" : 0,
"req_count4xx" : 0,
"req_count5xx" : 5,
"req_count_error" : 5,
"output_throughput" : 1695,
"input_throughput" : 2990,
"current_minute" : 1599552000,
"req_time" : "2020-09-08 16:00:00",
"cycle" : "HOUR",
"api_id" : "85deba41aae24839b14cdc03780e8bb6",
"group_id" : "22ea1e9d294e4349940b6452a7fd2207",
"provider" : "2cb5460f617c4822835e38f0966d8b93",
"register_time" : "2020-09-08 17:22:22"
} ]
} 状态码:400
Bad Request
{
"error_code" : "APIG.2012",
"error_msg" : "Invalid parameter value,parameterName:api_id. Please refer to the support documentation"
} 状态码:401
Unauthorized
{
"error_code" : "APIG.1002",
"error_msg" : "Incorrect token or token resolution failed"
} 状态码:403
Forbidden
{
"error_code" : "APIG.1005",
"error_msg" : "No permissions to request this method"
} 状态码:404
Not Found
{
"error_code" : "APIG.3002",
"error_msg" : "API 39bce6d25a3f470e8cf7b2c97174f7d9 does not exist"
} 状态码:500
Internal Server Error
{
"error_code" : "APIG.9999",
"error_msg" : "System error"
} 状态码
状态码 | 描述 |
|---|---|
200 | OK |
400 | Bad Request |
401 | Unauthorized |
403 | Forbidden |
404 | Not Found |
500 | Internal Server Error |
错误码
请参见错误码。

