mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
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:
135
docs/docs.go
135
docs/docs.go
@@ -187,6 +187,86 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/admin/alerts/thresholds": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"AdminAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Get current alert threshold configuration for traffic spike detection",
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"admin"
|
||||||
|
],
|
||||||
|
"summary": "Get alert thresholds",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/internal_api.AlertThresholdView"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/gin.H"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"put": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"AdminAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Update alert threshold configuration for traffic spike detection",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"admin"
|
||||||
|
],
|
||||||
|
"summary": "Update alert thresholds",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "Threshold configuration",
|
||||||
|
"name": "request",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/internal_api.UpdateAlertThresholdsRequest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/admin/alerts/{id}": {
|
"/admin/alerts/{id}": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
@@ -4829,6 +4909,35 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"internal_api.AlertThresholdView": {
|
||||||
|
"type": "object",
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"internal_api.AlertView": {
|
"internal_api.AlertView": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -5745,6 +5854,32 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"internal_api.UpdateAlertThresholdsRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"internal_api.UpdateMasterRequest": {
|
"internal_api.UpdateMasterRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|||||||
@@ -181,6 +181,86 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/admin/alerts/thresholds": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"AdminAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Get current alert threshold configuration for traffic spike detection",
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"admin"
|
||||||
|
],
|
||||||
|
"summary": "Get alert thresholds",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/internal_api.AlertThresholdView"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/gin.H"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"put": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"AdminAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Update alert threshold configuration for traffic spike detection",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"admin"
|
||||||
|
],
|
||||||
|
"summary": "Update alert thresholds",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "Threshold configuration",
|
||||||
|
"name": "request",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/internal_api.UpdateAlertThresholdsRequest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/admin/alerts/{id}": {
|
"/admin/alerts/{id}": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
@@ -4823,6 +4903,35 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"internal_api.AlertThresholdView": {
|
||||||
|
"type": "object",
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"internal_api.AlertView": {
|
"internal_api.AlertView": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -5739,6 +5848,32 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"internal_api.UpdateAlertThresholdsRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"internal_api.UpdateMasterRequest": {
|
"internal_api.UpdateMasterRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|||||||
@@ -443,6 +443,25 @@ definitions:
|
|||||||
warning:
|
warning:
|
||||||
type: integer
|
type: integer
|
||||||
type: object
|
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:
|
internal_api.AlertView:
|
||||||
properties:
|
properties:
|
||||||
acked_at:
|
acked_at:
|
||||||
@@ -1045,6 +1064,23 @@ definitions:
|
|||||||
propagate_to_keys:
|
propagate_to_keys:
|
||||||
type: boolean
|
type: boolean
|
||||||
type: object
|
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:
|
internal_api.UpdateMasterRequest:
|
||||||
properties:
|
properties:
|
||||||
global_qps:
|
global_qps:
|
||||||
@@ -1517,6 +1553,56 @@ paths:
|
|||||||
summary: Alert statistics
|
summary: Alert statistics
|
||||||
tags:
|
tags:
|
||||||
- admin
|
- 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:
|
/admin/api-keys:
|
||||||
get:
|
get:
|
||||||
description: List API keys with optional filters
|
description: List API keys with optional filters
|
||||||
|
|||||||
Reference in New Issue
Block a user