feat(monitoring): 监控页三分区仪表 + 上游探针(信息丰度增强)

此前监控页 6 张卡只有 2 个布尔有效(版本/运行时间/检查项三张死卡,
后端 /health 从未返回对应字段),与顶栏健康点重复。

后端:
- /health 补 version(importlib.metadata,失败降级 None)与
  uptime_seconds(monotonic,不受时钟跳变影响) —— 激活两张死卡
- 新增 GET /admin/monitoring/upstream:bzzoiro 可达性探针,
  轻量 GET 根端点,不携带 Key、不消耗采集配额;HTTP<500 视为可达
  (DNS/网络/TLS 层面),业务失败由死信与日志上报

前端: Monitoring 重排为三分区仪表
- 基础设施: 存活 / DB 就绪 / 版本+运行时间 / 上游探针(延迟)
- 数据管线: 最近采集成功率 / 死信待处理 / 数据缺口 / 统计覆盖
- LLM: 预测总数 / 平均延迟 / 有效率(<80% 警示色)
- 顶部「需要关注」聚合条: 任一异常亮红并直达处理页,全清显示状态行
- 各信号独立容错(Promise.allSettled),单项失败只降级对应卡片

测试: 新增 test_monitoring_endpoints.py 5 例(ASGITransport 真路由 +
mock 探针外呼);全量 331 passed 8 skipped
This commit is contained in:
WorkBuddy
2026-09-22 20:44:16 +08:00
parent f00bf71e8f
commit 5001093c3b
5 changed files with 414 additions and 106 deletions
+13
View File
@@ -363,6 +363,19 @@ export function fetchIngestStatus(): Promise<{ sources: IngestSourceStatus[] }>
return api.get<{ sources: IngestSourceStatus[] }>(`${API_BASE}/admin/ingest/status`)
}
/**
* 上游数据源(bzzoiro)可达性探针:轻量 GET,不携带 Key、不消耗配额
*/
export function fetchUpstreamProbe(): Promise<{
ok: boolean
status_code?: number
latency_ms: number
endpoint: string
error?: string
}> {
return api.get<never>(`${API_BASE}/admin/monitoring/upstream`)
}
/**
* 采集任务状态轮询(单任务)
*/