
# 查询应用请求的指标统计值 - ListStatisticsRomaApp
#### 功能介绍
查询统计时长内所有或某个应用请求的指标统计值。
受限使用，如有疑问请联系技术工程师。
#### 接口约束
调用超时或返回"request statistics error"报错时，请切换其他mode或缩短统计时长。
#### 调试
您可以在[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/ROMA/doc?api=ListStatisticsRomaApp)中调试该接口，支持自动认证鉴权。API Explorer可以自动生成SDK代码示例，并提供SDK代码示例调试功能。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-roma/roma_06_0018.html)。
#### URI
GET /v2/{project_id}/apic/instances/{instance_id}/statistics/roma-app
表1路径参数 
| 参数          | 是否必选 | 参数类型   | 描述                                  |
|:---|:---|:---|:---|
| project_id  | 是    | String | 项目ID，获取方式请参见API参考的"附录 \> 获取项目ID"章节。 |
| instance_id | 是    | String | 实例ID                                |
表2Query参数 
| 参数              | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
|:---|:---|:---|:---|
| mode            | 否    | String | 查询模式，默认为INSTANCE - ALL：实例下所有调用应用，要求主账号权限 - APP：指定调用应用 - INSTANCE：实例，默认值 注意：mode = APP或ALL时，接口响应中不返回cycle，api_id，group_id，roma_app_id，provider，register_time，status字段，且当cycle为HOUR和DAY时，接口响应中不返回req_time字段，若不填写consumer_app_id或roma_app_id，则要求主账号权限才能调用成功                                                                                                                                                                                               |
| consumer_app_id | 否    | String | 调用应用编号 查询模式为APP时必填                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| roma_app_id     | 否    | String | 集成应用编号，查询模式为INSTANCE时生效                                                                                                                                                                                                                                                                                                                                                                                                                                |
| cycle           | 否    | String | 查询统计周期 - minute：分钟 - hour：小时 - day：天 cycle=minute时，支持查询最近30天的数据 cycle=hour时，支持查询最近180天的数据 cycle=day时，支持查询最近360天的数据                                                                                                                                                                                                                                                                                                                                     |
| 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 - 同时给定start_time和end_time优先查询\[start_time, end_time\] - start_time不存在，end_time和duration存在且合法，则查询区间为\[end_time - duration, end_time\] - start_time和end_time不存在，duration存在且合法，令end_time=now，则查询区间为\[end_time - duration, end_time\] - end_time不存在，start_time和duration存在且合法，令end_time=now，则查询区间为\[end_time - duration, end_time\] - start_time，end_time和duration都不存在，报错missing time range parameters。 |
#### 请求参数
表3请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                       |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | 用户Token。通过调用IAM服务获取用户Token接口获取（响应消息头中X-Subject-Token的值）。 |
   
#### 响应参数
**状态码：200**
表4响应Body参数 
| 参数         | 参数类型                                                                                     | 描述             |
|:---|:---|:---|
| code       | String                                                                                   | 响应码            |
| start_time | Long                                                                                     | 统计起始时间UTC的时间戳  |
| end_time   | Long                                                                                     | 统计结束时间UTC的时间戳  |
| list       | Array of [StatisticsRomaApp] objects | APP维度下不同周期指标列表 |
   
 表5StatisticsRomaApp 
| 参数                  | 参数类型    | 描述                                          |
|:---|:---|:---|
| 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    | 当前时间的UTC格式的时间戳                              |
| req_time            | String  | 请求时间                                        |
| cycle               | String  | 查询统计周期                                      |
| roma_app_id         | String  | 集成应用编号                                      |
| provider            | String  | 项目编号                                        |
| register_time       | String  | 注册时间                                        |
| status              | Integer | 状态值： - 1：调度中，未上报CES - 2：已经成功上报CES 预留字段，暂不支持 |
   
**状态码：400**
表6响应Body参数 
| 参数         | 参数类型   | 描述   |
|:---|:---|:---|
| error_code | String | 错误码  |
| error_msg  | String | 错误描述 |
   
**状态码：401**
表7响应Body参数 
| 参数         | 参数类型   | 描述   |
|:---|:---|:---|
| error_code | String | 错误码  |
| error_msg  | String | 错误描述 |
   
**状态码：403**
表8响应Body参数 
| 参数         | 参数类型   | 描述   |
|:---|:---|:---|
| error_code | String | 错误码  |
| error_msg  | String | 错误描述 |
   
**状态码：404**
表9响应Body参数 
| 参数         | 参数类型   | 描述   |
|:---|:---|:---|
| error_code | String | 错误码  |
| error_msg  | String | 错误描述 |
   
**状态码：500**
表10响应Body参数 
| 参数         | 参数类型   | 描述   |
|:---|:---|:---|
| error_code | String | 错误码  |
| error_msg  | String | 错误描述 |
   
#### 请求示例
无
#### 响应示例
**状态码：200**
OK
```
{
  "code" : "APIG.0000",
  "start_time" : 1599112186,
  "end_time" : 1599616186,
  "list" : [ {
    "current_minute" : 1599552000,
    "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,
    "req_time" : ""
  } ]
}
```
**状态码：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 |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-roma/ErrorCode.html)。
