feat: add superadmin health center

This commit is contained in:
2026-01-17 09:18:05 +08:00
parent 94a10a3af0
commit 4f2b8ea3ad
14 changed files with 870 additions and 5 deletions

View File

@@ -1153,6 +1153,55 @@ const docTemplate = `{
}
}
},
"/super/v1/health/overview": {
"get": {
"description": "Platform health overview",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Health"
],
"summary": "Health overview",
"parameters": [
{
"type": "integer",
"description": "Tenant ID",
"name": "tenant_id",
"in": "query"
},
{
"type": "string",
"description": "Start time",
"name": "start_at",
"in": "query"
},
{
"type": "string",
"description": "End time",
"name": "end_at",
"in": "query"
},
{
"type": "integer",
"description": "Upload stuck hours",
"name": "upload_stuck_hours",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.SuperHealthOverviewResponse"
}
}
}
}
},
"/super/v1/notifications": {
"get": {
"description": "List notifications across tenants",
@@ -8669,6 +8718,127 @@ const docTemplate = `{
}
}
},
"dto.SuperHealthAlertItem": {
"type": "object",
"properties": {
"count": {
"description": "Count 关联数量(例如失败数、超时数)。",
"type": "integer"
},
"detail": {
"description": "Detail 告警详情说明。",
"type": "string"
},
"kind": {
"description": "Kind 告警类型order_error_rate/upload_error_rate/upload_stuck/tenant_health。",
"type": "string"
},
"level": {
"description": "Level 告警级别warning/risk。",
"type": "string"
},
"tenant_code": {
"description": "TenantCode 关联租户编码。",
"type": "string"
},
"tenant_id": {
"description": "TenantID 关联租户ID无则为 0。",
"type": "integer"
},
"tenant_name": {
"description": "TenantName 关联租户名称。",
"type": "string"
},
"title": {
"description": "Title 告警标题。",
"type": "string"
},
"updated_at": {
"description": "UpdatedAt 告警更新时间RFC3339。",
"type": "string"
}
}
},
"dto.SuperHealthOverviewResponse": {
"type": "object",
"properties": {
"alerts": {
"description": "Alerts 健康告警列表。",
"type": "array",
"items": {
"$ref": "#/definitions/dto.SuperHealthAlertItem"
}
},
"end_at": {
"description": "EndAt 统计结束时间RFC3339。",
"type": "string"
},
"order_failed": {
"description": "OrderFailed 失败订单数(统计区间内)。",
"type": "integer"
},
"order_failed_rate": {
"description": "OrderFailedRate 失败率(失败订单数 / 总订单数)。",
"type": "number"
},
"order_total": {
"description": "OrderTotal 订单总数(统计区间内)。",
"type": "integer"
},
"start_at": {
"description": "StartAt 统计开始时间RFC3339。",
"type": "string"
},
"storage_total_count": {
"description": "StorageTotalCount 资产总量(全量)。",
"type": "integer"
},
"storage_total_size": {
"description": "StorageTotalSize 资产总大小(字节,全量)。",
"type": "integer"
},
"tenant_id": {
"description": "TenantID 当前统计的租户ID0 代表全平台)。",
"type": "integer"
},
"tenant_risk_count": {
"description": "TenantRiskCount 健康风险租户数。",
"type": "integer"
},
"tenant_total": {
"description": "TenantTotal 租户总数。",
"type": "integer"
},
"tenant_warning_count": {
"description": "TenantWarningCount 健康预警租户数。",
"type": "integer"
},
"upload_failed": {
"description": "UploadFailed 上传失败资产数(统计区间内)。",
"type": "integer"
},
"upload_failed_rate": {
"description": "UploadFailedRate 上传失败率(失败资产数 / 总资产数)。",
"type": "number"
},
"upload_processing_stuck": {
"description": "UploadProcessingStuck 处理超时资产数processing 且超时)。",
"type": "integer"
},
"upload_stuck_hours": {
"description": "UploadStuckHours 上传处理超时时长(小时)。",
"type": "integer"
},
"upload_total": {
"description": "UploadTotal 上传资产总数(统计区间内)。",
"type": "integer"
},
"upload_uploaded_stuck": {
"description": "UploadUploadedStuck 已上传但未进入处理的超时资产数uploaded 且超时)。",
"type": "integer"
}
}
},
"dto.SuperLedgerItem": {
"type": "object",
"properties": {

View File

@@ -1147,6 +1147,55 @@
}
}
},
"/super/v1/health/overview": {
"get": {
"description": "Platform health overview",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Health"
],
"summary": "Health overview",
"parameters": [
{
"type": "integer",
"description": "Tenant ID",
"name": "tenant_id",
"in": "query"
},
{
"type": "string",
"description": "Start time",
"name": "start_at",
"in": "query"
},
{
"type": "string",
"description": "End time",
"name": "end_at",
"in": "query"
},
{
"type": "integer",
"description": "Upload stuck hours",
"name": "upload_stuck_hours",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.SuperHealthOverviewResponse"
}
}
}
}
},
"/super/v1/notifications": {
"get": {
"description": "List notifications across tenants",
@@ -8663,6 +8712,127 @@
}
}
},
"dto.SuperHealthAlertItem": {
"type": "object",
"properties": {
"count": {
"description": "Count 关联数量(例如失败数、超时数)。",
"type": "integer"
},
"detail": {
"description": "Detail 告警详情说明。",
"type": "string"
},
"kind": {
"description": "Kind 告警类型order_error_rate/upload_error_rate/upload_stuck/tenant_health。",
"type": "string"
},
"level": {
"description": "Level 告警级别warning/risk。",
"type": "string"
},
"tenant_code": {
"description": "TenantCode 关联租户编码。",
"type": "string"
},
"tenant_id": {
"description": "TenantID 关联租户ID无则为 0。",
"type": "integer"
},
"tenant_name": {
"description": "TenantName 关联租户名称。",
"type": "string"
},
"title": {
"description": "Title 告警标题。",
"type": "string"
},
"updated_at": {
"description": "UpdatedAt 告警更新时间RFC3339。",
"type": "string"
}
}
},
"dto.SuperHealthOverviewResponse": {
"type": "object",
"properties": {
"alerts": {
"description": "Alerts 健康告警列表。",
"type": "array",
"items": {
"$ref": "#/definitions/dto.SuperHealthAlertItem"
}
},
"end_at": {
"description": "EndAt 统计结束时间RFC3339。",
"type": "string"
},
"order_failed": {
"description": "OrderFailed 失败订单数(统计区间内)。",
"type": "integer"
},
"order_failed_rate": {
"description": "OrderFailedRate 失败率(失败订单数 / 总订单数)。",
"type": "number"
},
"order_total": {
"description": "OrderTotal 订单总数(统计区间内)。",
"type": "integer"
},
"start_at": {
"description": "StartAt 统计开始时间RFC3339。",
"type": "string"
},
"storage_total_count": {
"description": "StorageTotalCount 资产总量(全量)。",
"type": "integer"
},
"storage_total_size": {
"description": "StorageTotalSize 资产总大小(字节,全量)。",
"type": "integer"
},
"tenant_id": {
"description": "TenantID 当前统计的租户ID0 代表全平台)。",
"type": "integer"
},
"tenant_risk_count": {
"description": "TenantRiskCount 健康风险租户数。",
"type": "integer"
},
"tenant_total": {
"description": "TenantTotal 租户总数。",
"type": "integer"
},
"tenant_warning_count": {
"description": "TenantWarningCount 健康预警租户数。",
"type": "integer"
},
"upload_failed": {
"description": "UploadFailed 上传失败资产数(统计区间内)。",
"type": "integer"
},
"upload_failed_rate": {
"description": "UploadFailedRate 上传失败率(失败资产数 / 总资产数)。",
"type": "number"
},
"upload_processing_stuck": {
"description": "UploadProcessingStuck 处理超时资产数processing 且超时)。",
"type": "integer"
},
"upload_stuck_hours": {
"description": "UploadStuckHours 上传处理超时时长(小时)。",
"type": "integer"
},
"upload_total": {
"description": "UploadTotal 上传资产总数(统计区间内)。",
"type": "integer"
},
"upload_uploaded_stuck": {
"description": "UploadUploadedStuck 已上传但未进入处理的超时资产数uploaded 且超时)。",
"type": "integer"
}
}
},
"dto.SuperLedgerItem": {
"type": "object",
"properties": {

View File

@@ -1762,6 +1762,95 @@ definitions:
required:
- action
type: object
dto.SuperHealthAlertItem:
properties:
count:
description: Count 关联数量(例如失败数、超时数)。
type: integer
detail:
description: Detail 告警详情说明。
type: string
kind:
description: Kind 告警类型order_error_rate/upload_error_rate/upload_stuck/tenant_health
type: string
level:
description: Level 告警级别warning/risk
type: string
tenant_code:
description: TenantCode 关联租户编码。
type: string
tenant_id:
description: TenantID 关联租户ID无则为 0
type: integer
tenant_name:
description: TenantName 关联租户名称。
type: string
title:
description: Title 告警标题。
type: string
updated_at:
description: UpdatedAt 告警更新时间RFC3339
type: string
type: object
dto.SuperHealthOverviewResponse:
properties:
alerts:
description: Alerts 健康告警列表。
items:
$ref: '#/definitions/dto.SuperHealthAlertItem'
type: array
end_at:
description: EndAt 统计结束时间RFC3339
type: string
order_failed:
description: OrderFailed 失败订单数(统计区间内)。
type: integer
order_failed_rate:
description: OrderFailedRate 失败率(失败订单数 / 总订单数)。
type: number
order_total:
description: OrderTotal 订单总数(统计区间内)。
type: integer
start_at:
description: StartAt 统计开始时间RFC3339
type: string
storage_total_count:
description: StorageTotalCount 资产总量(全量)。
type: integer
storage_total_size:
description: StorageTotalSize 资产总大小(字节,全量)。
type: integer
tenant_id:
description: TenantID 当前统计的租户ID0 代表全平台)。
type: integer
tenant_risk_count:
description: TenantRiskCount 健康风险租户数。
type: integer
tenant_total:
description: TenantTotal 租户总数。
type: integer
tenant_warning_count:
description: TenantWarningCount 健康预警租户数。
type: integer
upload_failed:
description: UploadFailed 上传失败资产数(统计区间内)。
type: integer
upload_failed_rate:
description: UploadFailedRate 上传失败率(失败资产数 / 总资产数)。
type: number
upload_processing_stuck:
description: UploadProcessingStuck 处理超时资产数processing 且超时)。
type: integer
upload_stuck_hours:
description: UploadStuckHours 上传处理超时时长(小时)。
type: integer
upload_total:
description: UploadTotal 上传资产总数(统计区间内)。
type: integer
upload_uploaded_stuck:
description: UploadUploadedStuck 已上传但未进入处理的超时资产数uploaded 且超时)。
type: integer
type: object
dto.SuperLedgerItem:
properties:
amount:
@@ -4064,6 +4153,38 @@ paths:
summary: List ledgers
tags:
- Finance
/super/v1/health/overview:
get:
consumes:
- application/json
description: Platform health overview
parameters:
- description: Tenant ID
in: query
name: tenant_id
type: integer
- description: Start time
in: query
name: start_at
type: string
- description: End time
in: query
name: end_at
type: string
- description: Upload stuck hours
in: query
name: upload_stuck_hours
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.SuperHealthOverviewResponse'
summary: Health overview
tags:
- Health
/super/v1/notifications:
get:
consumes: