mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
docs(api): update swagger documentation for traffic charts and trends
Regenerate API documentation to reflect recent statistics features: - Add definition for new `/admin/logs/stats/traffic-chart` endpoint - Update dashboard summary with `include_trends` parameter and new time periods - Add `DashboardTrends` and `TrafficChartResponse` data structures - Update alert types to include `traffic_spike
This commit is contained in:
178
docs/docs.go
178
docs/docs.go
@@ -86,7 +86,7 @@ const docTemplate = `{
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "filter by type (rate_limit, error_spike, quota_exceeded, key_disabled, key_expired, provider_down)",
|
||||
"description": "filter by type (rate_limit, error_spike, quota_exceeded, key_disabled, key_expired, provider_down, traffic_spike)",
|
||||
"name": "type",
|
||||
"in": "query"
|
||||
}
|
||||
@@ -1183,7 +1183,7 @@ const docTemplate = `{
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "time period: today, week, month, all",
|
||||
"description": "time period: today, week, month, last7d, last30d, all",
|
||||
"name": "period",
|
||||
"in": "query"
|
||||
},
|
||||
@@ -1198,6 +1198,12 @@ const docTemplate = `{
|
||||
"description": "unix seconds",
|
||||
"name": "until",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"description": "include trend data comparing to previous period",
|
||||
"name": "include_trends",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -1610,6 +1616,73 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/admin/logs/stats/traffic-chart": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"AdminAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Get time × model aggregated data for stacked traffic charts. Returns time buckets with per-model breakdown.",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"summary": "Traffic chart data (admin)",
|
||||
"parameters": [
|
||||
{
|
||||
"enum": [
|
||||
"hour",
|
||||
"minute"
|
||||
],
|
||||
"type": "string",
|
||||
"description": "Time granularity: hour (default) or minute",
|
||||
"name": "granularity",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Start time (unix seconds), defaults to 24h ago",
|
||||
"name": "since",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "End time (unix seconds), defaults to now",
|
||||
"name": "until",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Number of top models to return (1-20), defaults to 5",
|
||||
"name": "top_n",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_api.TrafficChartResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/admin/logs/webhook": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -4510,6 +4583,9 @@ const docTemplate = `{
|
||||
"latency_ms": {
|
||||
"type": "integer"
|
||||
},
|
||||
"master_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"model": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -5138,11 +5214,36 @@ const docTemplate = `{
|
||||
"$ref": "#/definitions/internal_api.TopModelStat"
|
||||
}
|
||||
},
|
||||
"trends": {
|
||||
"description": "Only present when include_trends=true",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/internal_api.DashboardTrends"
|
||||
}
|
||||
]
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_api.DashboardTrends": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"error_rate": {
|
||||
"$ref": "#/definitions/internal_api.TrendInfo"
|
||||
},
|
||||
"latency": {
|
||||
"$ref": "#/definitions/internal_api.TrendInfo"
|
||||
},
|
||||
"requests": {
|
||||
"$ref": "#/definitions/internal_api.TrendInfo"
|
||||
},
|
||||
"tokens": {
|
||||
"$ref": "#/definitions/internal_api.TrendInfo"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_api.DeleteLogsRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -5837,6 +5938,79 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_api.TrafficBucket": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"breakdown": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/internal_api.TrafficMetrics"
|
||||
}
|
||||
},
|
||||
"time": {
|
||||
"type": "string"
|
||||
},
|
||||
"timestamp": {
|
||||
"type": "integer"
|
||||
},
|
||||
"total": {
|
||||
"$ref": "#/definitions/internal_api.TrafficMetrics"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_api.TrafficChartResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"buckets": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/internal_api.TrafficBucket"
|
||||
}
|
||||
},
|
||||
"granularity": {
|
||||
"type": "string"
|
||||
},
|
||||
"models": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"since": {
|
||||
"type": "integer"
|
||||
},
|
||||
"until": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_api.TrafficMetrics": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"tokens_in": {
|
||||
"type": "integer"
|
||||
},
|
||||
"tokens_out": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_api.TrendInfo": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"delta": {
|
||||
"description": "Percentage change from previous period (nil if no baseline)",
|
||||
"type": "number"
|
||||
},
|
||||
"direction": {
|
||||
"description": "\"up\", \"down\", \"stable\", or \"new\" (no baseline)",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_api.UpdateAccessRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
Reference in New Issue
Block a user