docs(api): add alert thresholds endpoints to swagger documentation

Add OpenAPI documentation for the new alert threshold management
endpoints used in traffic spike detection:

- GET /admin/alerts/thresholds - retrieve current threshold config
- PUT /admin/alerts/thresholds - update threshold configuration

Include AlertThresholdView and UpdateAlertThresholdsRequest schema
definitions with properties for QPS, RPM, TPM, RPD, TPD limits.
This commit is contained in:
zenfun
2025-12-31 15:57:27 +08:00
parent ba54abd424
commit 0b9556ee7e
3 changed files with 356 additions and 0 deletions

View File

@@ -443,6 +443,25 @@ definitions:
warning:
type: integer
type: object
internal_api.AlertThresholdView:
properties:
global_qps:
type: integer
master_rpd:
type: integer
master_rpm:
type: integer
master_tpd:
type: integer
master_tpm:
type: integer
min_rpm_requests_1m:
type: integer
min_tpm_tokens_1m:
type: integer
updated_at:
type: integer
type: object
internal_api.AlertView:
properties:
acked_at:
@@ -1045,6 +1064,23 @@ definitions:
propagate_to_keys:
type: boolean
type: object
internal_api.UpdateAlertThresholdsRequest:
properties:
global_qps:
type: integer
master_rpd:
type: integer
master_rpm:
type: integer
master_tpd:
type: integer
master_tpm:
type: integer
min_rpm_requests_1m:
type: integer
min_tpm_tokens_1m:
type: integer
type: object
internal_api.UpdateMasterRequest:
properties:
global_qps:
@@ -1517,6 +1553,56 @@ paths:
summary: Alert statistics
tags:
- admin
/admin/alerts/thresholds:
get:
description: Get current alert threshold configuration for traffic spike detection
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/internal_api.AlertThresholdView'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/gin.H'
security:
- AdminAuth: []
summary: Get alert thresholds
tags:
- admin
put:
consumes:
- application/json
description: Update alert threshold configuration for traffic spike detection
parameters:
- description: Threshold configuration
in: body
name: request
required: true
schema:
$ref: '#/definitions/internal_api.UpdateAlertThresholdsRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/internal_api.AlertThresholdView'
"400":
description: Bad Request
schema:
$ref: '#/definitions/gin.H'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/gin.H'
security:
- AdminAuth: []
summary: Update alert thresholds
tags:
- admin
/admin/api-keys:
get:
description: List API keys with optional filters