mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
docs: update swagger docs for alerts API and minute-level stats
Add OpenAPI documentation for the new alerts management system: - CRUD endpoints for system alerts (/admin/alerts) - Alert acknowledgment and resolution endpoints - Alert statistics endpoint - Alert filtering by status, severity, and type Also document minute-level aggregation support for log stats with 6-hour time range limitation.
This commit is contained in:
515
docs/docs.go
515
docs/docs.go
@@ -44,6 +44,360 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/admin/alerts": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"AdminAuth": []
|
||||
}
|
||||
],
|
||||
"description": "List system alerts with optional filters",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"summary": "List alerts",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "limit (default 50, max 200)",
|
||||
"name": "limit",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "offset",
|
||||
"name": "offset",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "filter by status (active, acknowledged, resolved, dismissed)",
|
||||
"name": "status",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "filter by severity (info, warning, critical)",
|
||||
"name": "severity",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "filter by type (rate_limit, error_spike, quota_exceeded, key_disabled, key_expired, provider_down)",
|
||||
"name": "type",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_api.ListAlertsResponse"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"AdminAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Create a new system alert",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"summary": "Create alert",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Alert data",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_api.CreateAlertRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Created",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_api.AlertView"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/admin/alerts/stats": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"AdminAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Get alert count statistics by status and severity",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"summary": "Alert statistics",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_api.AlertStats"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/admin/alerts/{id}": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"AdminAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Get a single alert by ID",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"summary": "Get alert",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Alert ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_api.AlertView"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"security": [
|
||||
{
|
||||
"AdminAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Dismiss an alert (soft delete)",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"summary": "Dismiss alert",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Alert ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/admin/alerts/{id}/ack": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"AdminAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Mark an alert as acknowledged",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"summary": "Acknowledge alert",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Alert ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Ack data",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_api.AckAlertRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_api.AlertView"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/admin/alerts/{id}/resolve": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"AdminAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Mark an alert as resolved",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"summary": "Resolve alert",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Alert ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_api.AlertView"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/admin/api-keys": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -1105,7 +1459,7 @@ const docTemplate = `{
|
||||
"AdminAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Aggregate log stats with basic filtering. Use group_by param for grouped statistics (model/day/month/hour). Without group_by returns LogStatsResponse; with group_by returns GroupedStatsResponse.",
|
||||
"description": "Aggregate log stats with basic filtering. Use group_by param for grouped statistics (model/day/month/hour/minute). Without group_by returns LogStatsResponse; with group_by returns GroupedStatsResponse. Note: minute-level aggregation is limited to 6-hour time ranges.",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -1131,10 +1485,11 @@ const docTemplate = `{
|
||||
"model",
|
||||
"day",
|
||||
"month",
|
||||
"hour"
|
||||
"hour",
|
||||
"minute"
|
||||
],
|
||||
"type": "string",
|
||||
"description": "group by dimension: model, day, month, hour. Returns GroupedStatsResponse when specified.",
|
||||
"description": "group by dimension: model, day, month, hour, minute. Returns GroupedStatsResponse when specified.",
|
||||
"name": "group_by",
|
||||
"in": "query"
|
||||
}
|
||||
@@ -1146,6 +1501,12 @@ const docTemplate = `{
|
||||
"$ref": "#/definitions/internal_api.GroupedStatsResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
@@ -4342,6 +4703,14 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_api.AckAlertRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"acked_by": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_api.AdminUsageStatsResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -4374,6 +4743,85 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_api.AlertStats": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"acknowledged": {
|
||||
"type": "integer"
|
||||
},
|
||||
"active": {
|
||||
"type": "integer"
|
||||
},
|
||||
"critical": {
|
||||
"type": "integer"
|
||||
},
|
||||
"info": {
|
||||
"type": "integer"
|
||||
},
|
||||
"resolved": {
|
||||
"type": "integer"
|
||||
},
|
||||
"total": {
|
||||
"type": "integer"
|
||||
},
|
||||
"warning": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_api.AlertView": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"acked_at": {
|
||||
"type": "integer"
|
||||
},
|
||||
"acked_by": {
|
||||
"type": "string"
|
||||
},
|
||||
"created_at": {
|
||||
"type": "integer"
|
||||
},
|
||||
"expires_at": {
|
||||
"type": "integer"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
},
|
||||
"metadata": {
|
||||
"type": "string"
|
||||
},
|
||||
"related_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"related_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"related_type": {
|
||||
"type": "string"
|
||||
},
|
||||
"resolved_at": {
|
||||
"type": "integer"
|
||||
},
|
||||
"severity": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_api.BatchActionRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -4433,6 +4881,43 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_api.CreateAlertRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"severity",
|
||||
"title",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"expires_at": {
|
||||
"type": "integer"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
},
|
||||
"metadata": {
|
||||
"type": "string"
|
||||
},
|
||||
"related_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"related_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"related_type": {
|
||||
"type": "string"
|
||||
},
|
||||
"severity": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_api.CreateMasterRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@@ -4528,6 +5013,10 @@ const docTemplate = `{
|
||||
"description": "For group_by=hour",
|
||||
"type": "string"
|
||||
},
|
||||
"minute": {
|
||||
"description": "For group_by=minute",
|
||||
"type": "string"
|
||||
},
|
||||
"model": {
|
||||
"description": "For group_by=model",
|
||||
"type": "string"
|
||||
@@ -4603,6 +5092,26 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_api.ListAlertsResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"items": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/internal_api.AlertView"
|
||||
}
|
||||
},
|
||||
"limit": {
|
||||
"type": "integer"
|
||||
},
|
||||
"offset": {
|
||||
"type": "integer"
|
||||
},
|
||||
"total": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_api.ListLogsResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -38,6 +38,360 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/admin/alerts": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"AdminAuth": []
|
||||
}
|
||||
],
|
||||
"description": "List system alerts with optional filters",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"summary": "List alerts",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "limit (default 50, max 200)",
|
||||
"name": "limit",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "offset",
|
||||
"name": "offset",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "filter by status (active, acknowledged, resolved, dismissed)",
|
||||
"name": "status",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "filter by severity (info, warning, critical)",
|
||||
"name": "severity",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "filter by type (rate_limit, error_spike, quota_exceeded, key_disabled, key_expired, provider_down)",
|
||||
"name": "type",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_api.ListAlertsResponse"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"AdminAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Create a new system alert",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"summary": "Create alert",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Alert data",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_api.CreateAlertRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Created",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_api.AlertView"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/admin/alerts/stats": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"AdminAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Get alert count statistics by status and severity",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"summary": "Alert statistics",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_api.AlertStats"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/admin/alerts/{id}": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"AdminAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Get a single alert by ID",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"summary": "Get alert",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Alert ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_api.AlertView"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"security": [
|
||||
{
|
||||
"AdminAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Dismiss an alert (soft delete)",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"summary": "Dismiss alert",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Alert ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/admin/alerts/{id}/ack": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"AdminAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Mark an alert as acknowledged",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"summary": "Acknowledge alert",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Alert ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Ack data",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_api.AckAlertRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_api.AlertView"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/admin/alerts/{id}/resolve": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"AdminAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Mark an alert as resolved",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"summary": "Resolve alert",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Alert ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_api.AlertView"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/admin/api-keys": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -1099,7 +1453,7 @@
|
||||
"AdminAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Aggregate log stats with basic filtering. Use group_by param for grouped statistics (model/day/month/hour). Without group_by returns LogStatsResponse; with group_by returns GroupedStatsResponse.",
|
||||
"description": "Aggregate log stats with basic filtering. Use group_by param for grouped statistics (model/day/month/hour/minute). Without group_by returns LogStatsResponse; with group_by returns GroupedStatsResponse. Note: minute-level aggregation is limited to 6-hour time ranges.",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -1125,10 +1479,11 @@
|
||||
"model",
|
||||
"day",
|
||||
"month",
|
||||
"hour"
|
||||
"hour",
|
||||
"minute"
|
||||
],
|
||||
"type": "string",
|
||||
"description": "group by dimension: model, day, month, hour. Returns GroupedStatsResponse when specified.",
|
||||
"description": "group by dimension: model, day, month, hour, minute. Returns GroupedStatsResponse when specified.",
|
||||
"name": "group_by",
|
||||
"in": "query"
|
||||
}
|
||||
@@ -1140,6 +1495,12 @@
|
||||
"$ref": "#/definitions/internal_api.GroupedStatsResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gin.H"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
@@ -4336,6 +4697,14 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_api.AckAlertRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"acked_by": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_api.AdminUsageStatsResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -4368,6 +4737,85 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_api.AlertStats": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"acknowledged": {
|
||||
"type": "integer"
|
||||
},
|
||||
"active": {
|
||||
"type": "integer"
|
||||
},
|
||||
"critical": {
|
||||
"type": "integer"
|
||||
},
|
||||
"info": {
|
||||
"type": "integer"
|
||||
},
|
||||
"resolved": {
|
||||
"type": "integer"
|
||||
},
|
||||
"total": {
|
||||
"type": "integer"
|
||||
},
|
||||
"warning": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_api.AlertView": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"acked_at": {
|
||||
"type": "integer"
|
||||
},
|
||||
"acked_by": {
|
||||
"type": "string"
|
||||
},
|
||||
"created_at": {
|
||||
"type": "integer"
|
||||
},
|
||||
"expires_at": {
|
||||
"type": "integer"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
},
|
||||
"metadata": {
|
||||
"type": "string"
|
||||
},
|
||||
"related_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"related_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"related_type": {
|
||||
"type": "string"
|
||||
},
|
||||
"resolved_at": {
|
||||
"type": "integer"
|
||||
},
|
||||
"severity": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_api.BatchActionRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -4427,6 +4875,43 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_api.CreateAlertRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"severity",
|
||||
"title",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"expires_at": {
|
||||
"type": "integer"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
},
|
||||
"metadata": {
|
||||
"type": "string"
|
||||
},
|
||||
"related_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"related_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"related_type": {
|
||||
"type": "string"
|
||||
},
|
||||
"severity": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_api.CreateMasterRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@@ -4522,6 +5007,10 @@
|
||||
"description": "For group_by=hour",
|
||||
"type": "string"
|
||||
},
|
||||
"minute": {
|
||||
"description": "For group_by=minute",
|
||||
"type": "string"
|
||||
},
|
||||
"model": {
|
||||
"description": "For group_by=model",
|
||||
"type": "string"
|
||||
@@ -4597,6 +5086,26 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_api.ListAlertsResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"items": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/internal_api.AlertView"
|
||||
}
|
||||
},
|
||||
"limit": {
|
||||
"type": "integer"
|
||||
},
|
||||
"offset": {
|
||||
"type": "integer"
|
||||
},
|
||||
"total": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_api.ListLogsResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -400,6 +400,11 @@ definitions:
|
||||
type: string
|
||||
type: array
|
||||
type: object
|
||||
internal_api.AckAlertRequest:
|
||||
properties:
|
||||
acked_by:
|
||||
type: string
|
||||
type: object
|
||||
internal_api.AdminUsageStatsResponse:
|
||||
properties:
|
||||
active_masters:
|
||||
@@ -421,6 +426,58 @@ definitions:
|
||||
total_tokens:
|
||||
type: integer
|
||||
type: object
|
||||
internal_api.AlertStats:
|
||||
properties:
|
||||
acknowledged:
|
||||
type: integer
|
||||
active:
|
||||
type: integer
|
||||
critical:
|
||||
type: integer
|
||||
info:
|
||||
type: integer
|
||||
resolved:
|
||||
type: integer
|
||||
total:
|
||||
type: integer
|
||||
warning:
|
||||
type: integer
|
||||
type: object
|
||||
internal_api.AlertView:
|
||||
properties:
|
||||
acked_at:
|
||||
type: integer
|
||||
acked_by:
|
||||
type: string
|
||||
created_at:
|
||||
type: integer
|
||||
expires_at:
|
||||
type: integer
|
||||
id:
|
||||
type: integer
|
||||
message:
|
||||
type: string
|
||||
metadata:
|
||||
type: string
|
||||
related_id:
|
||||
type: integer
|
||||
related_name:
|
||||
type: string
|
||||
related_type:
|
||||
type: string
|
||||
resolved_at:
|
||||
type: integer
|
||||
severity:
|
||||
type: string
|
||||
status:
|
||||
type: string
|
||||
title:
|
||||
type: string
|
||||
type:
|
||||
type: string
|
||||
updated_at:
|
||||
type: integer
|
||||
type: object
|
||||
internal_api.BatchActionRequest:
|
||||
properties:
|
||||
action:
|
||||
@@ -459,6 +516,31 @@ definitions:
|
||||
total:
|
||||
type: integer
|
||||
type: object
|
||||
internal_api.CreateAlertRequest:
|
||||
properties:
|
||||
expires_at:
|
||||
type: integer
|
||||
message:
|
||||
type: string
|
||||
metadata:
|
||||
type: string
|
||||
related_id:
|
||||
type: integer
|
||||
related_name:
|
||||
type: string
|
||||
related_type:
|
||||
type: string
|
||||
severity:
|
||||
type: string
|
||||
title:
|
||||
type: string
|
||||
type:
|
||||
type: string
|
||||
required:
|
||||
- severity
|
||||
- title
|
||||
- type
|
||||
type: object
|
||||
internal_api.CreateMasterRequest:
|
||||
properties:
|
||||
global_qps:
|
||||
@@ -522,6 +604,9 @@ definitions:
|
||||
hour:
|
||||
description: For group_by=hour
|
||||
type: string
|
||||
minute:
|
||||
description: For group_by=minute
|
||||
type: string
|
||||
model:
|
||||
description: For group_by=model
|
||||
type: string
|
||||
@@ -571,6 +656,19 @@ definitions:
|
||||
avg_ms:
|
||||
type: number
|
||||
type: object
|
||||
internal_api.ListAlertsResponse:
|
||||
properties:
|
||||
items:
|
||||
items:
|
||||
$ref: '#/definitions/internal_api.AlertView'
|
||||
type: array
|
||||
limit:
|
||||
type: integer
|
||||
offset:
|
||||
type: integer
|
||||
total:
|
||||
type: integer
|
||||
type: object
|
||||
internal_api.ListLogsResponse:
|
||||
properties:
|
||||
items:
|
||||
@@ -1149,6 +1247,231 @@ paths:
|
||||
summary: Get system information
|
||||
tags:
|
||||
- Public
|
||||
/admin/alerts:
|
||||
get:
|
||||
description: List system alerts with optional filters
|
||||
parameters:
|
||||
- description: limit (default 50, max 200)
|
||||
in: query
|
||||
name: limit
|
||||
type: integer
|
||||
- description: offset
|
||||
in: query
|
||||
name: offset
|
||||
type: integer
|
||||
- description: filter by status (active, acknowledged, resolved, dismissed)
|
||||
in: query
|
||||
name: status
|
||||
type: string
|
||||
- description: filter by severity (info, warning, critical)
|
||||
in: query
|
||||
name: severity
|
||||
type: string
|
||||
- description: filter by type (rate_limit, error_spike, quota_exceeded, key_disabled,
|
||||
key_expired, provider_down)
|
||||
in: query
|
||||
name: type
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/internal_api.ListAlertsResponse'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/gin.H'
|
||||
security:
|
||||
- AdminAuth: []
|
||||
summary: List alerts
|
||||
tags:
|
||||
- admin
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Create a new system alert
|
||||
parameters:
|
||||
- description: Alert data
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/internal_api.CreateAlertRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"201":
|
||||
description: Created
|
||||
schema:
|
||||
$ref: '#/definitions/internal_api.AlertView'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/gin.H'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/gin.H'
|
||||
security:
|
||||
- AdminAuth: []
|
||||
summary: Create alert
|
||||
tags:
|
||||
- admin
|
||||
/admin/alerts/{id}:
|
||||
delete:
|
||||
description: Dismiss an alert (soft delete)
|
||||
parameters:
|
||||
- description: Alert ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/gin.H'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/gin.H'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/gin.H'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/gin.H'
|
||||
security:
|
||||
- AdminAuth: []
|
||||
summary: Dismiss alert
|
||||
tags:
|
||||
- admin
|
||||
get:
|
||||
description: Get a single alert by ID
|
||||
parameters:
|
||||
- description: Alert ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/internal_api.AlertView'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/gin.H'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/gin.H'
|
||||
security:
|
||||
- AdminAuth: []
|
||||
summary: Get alert
|
||||
tags:
|
||||
- admin
|
||||
/admin/alerts/{id}/ack:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Mark an alert as acknowledged
|
||||
parameters:
|
||||
- description: Alert ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
- description: Ack data
|
||||
in: body
|
||||
name: request
|
||||
schema:
|
||||
$ref: '#/definitions/internal_api.AckAlertRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/internal_api.AlertView'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/gin.H'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/gin.H'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/gin.H'
|
||||
security:
|
||||
- AdminAuth: []
|
||||
summary: Acknowledge alert
|
||||
tags:
|
||||
- admin
|
||||
/admin/alerts/{id}/resolve:
|
||||
post:
|
||||
description: Mark an alert as resolved
|
||||
parameters:
|
||||
- description: Alert ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/internal_api.AlertView'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/gin.H'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/gin.H'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/gin.H'
|
||||
security:
|
||||
- AdminAuth: []
|
||||
summary: Resolve alert
|
||||
tags:
|
||||
- admin
|
||||
/admin/alerts/stats:
|
||||
get:
|
||||
description: Get alert count statistics by status and severity
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/internal_api.AlertStats'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/gin.H'
|
||||
security:
|
||||
- AdminAuth: []
|
||||
summary: Alert statistics
|
||||
tags:
|
||||
- admin
|
||||
/admin/api-keys:
|
||||
get:
|
||||
description: List API keys with optional filters
|
||||
@@ -1824,9 +2147,10 @@ paths:
|
||||
- admin
|
||||
/admin/logs/stats:
|
||||
get:
|
||||
description: Aggregate log stats with basic filtering. Use group_by param for
|
||||
grouped statistics (model/day/month/hour). Without group_by returns LogStatsResponse;
|
||||
with group_by returns GroupedStatsResponse.
|
||||
description: 'Aggregate log stats with basic filtering. Use group_by param for
|
||||
grouped statistics (model/day/month/hour/minute). Without group_by returns
|
||||
LogStatsResponse; with group_by returns GroupedStatsResponse. Note: minute-level
|
||||
aggregation is limited to 6-hour time ranges.'
|
||||
parameters:
|
||||
- description: unix seconds
|
||||
in: query
|
||||
@@ -1836,13 +2160,14 @@ paths:
|
||||
in: query
|
||||
name: until
|
||||
type: integer
|
||||
- description: 'group by dimension: model, day, month, hour. Returns GroupedStatsResponse
|
||||
when specified.'
|
||||
- description: 'group by dimension: model, day, month, hour, minute. Returns
|
||||
GroupedStatsResponse when specified.'
|
||||
enum:
|
||||
- model
|
||||
- day
|
||||
- month
|
||||
- hour
|
||||
- minute
|
||||
in: query
|
||||
name: group_by
|
||||
type: string
|
||||
@@ -1853,6 +2178,10 @@ paths:
|
||||
description: Grouped stats (when group_by is specified)
|
||||
schema:
|
||||
$ref: '#/definitions/internal_api.GroupedStatsResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/gin.H'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
|
||||
Reference in New Issue
Block a user