获取请求分析

OpenAPI 契约

方法
GET
路径
/api/v1/analytics/requests
认证
jwtBearer (bearer) OR automationKey (bearer)
响应状态
200 400 401 403 429 500
请求与响应 Schema
JSON
{
  "requestBody": {},
  "responses": {
    "200": {
      "description": "Request analytics",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/RequestAnalyticsResponse"
        }
      }
    },
    "400": {
      "description": "Invalid request",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/RequestError"
        }
      }
    },
    "401": {
      "description": "Authentication required or invalid",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/SecurityError"
        }
      }
    },
    "403": {
      "description": "Authenticated but not permitted",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/SecurityError"
        }
      }
    },
    "429": {
      "description": "Rate limit exceeded",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/SecurityError"
        }
      }
    },
    "500": {
      "description": "Unexpected server error",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/ApiError"
        }
      }
    }
  }
}

如需自定义时间范围,请同时提供 ISO-8601 格式的 from 和 to。它们覆盖 range,结束时间必须晚于开始时间,跨度不得超过 366 天。还支持与请求日志相同的筛选条件:search、逗号分隔的 method 和 status、statusClass、带通配符的 path、apiKeyId、minLatencyMs 和 maxLatencyMs。图表、汇总值及分组统计均使用筛选后的时间范围。

GET /api/v1/analytics/requests 接受 JWT 或带 analytics:read 的 nfy_ 密钥。range 可为 7d、30d(默认)、90d 或 1y;granularity 可为 hour(默认)或 day。groupBy 可为 none(默认)、authType、method、statusClass 或 apiKey。

响应包含按时间排列的请求数分桶,当设置了 groupBy 时每个分桶带有按维度细分的计数、每个分桶的成功率和延迟分位数(p50/p90/p95/p99)点、覆盖整个范围的汇总统计、按 groupBy 分组并按次数排序的细分,以及该范围内调用最多的十个路径。

http
GET /api/v1/analytics/requests?range=30d&granularity=hour&groupBy=statusClass
Authorization: Bearer <access token>