Files
Nexus/docs/changelog/2026-06-09-dashboard-24h-fleet-metrics.md
2026-07-08 22:31:31 +08:00

1.2 KiB
Raw Permalink Blame History

2026-06-09 — Dashboard 24h 资源趋势(B-02

变更摘要

仪表盘新增「24h 资源趋势」卡片:每 10 分钟采样舰队 CPU/内存/磁盘均值,MySQL 保留 7 天;前端用 Vuetify v-sparkline 展示,支持三指标切换。

动机

对齐计划 B-02:运维需查看近 24h 全舰队资源变化,而非仅 Redis 实时快照。

涉及文件

  • server/domain/models/__init__.pyFleetMetricSample
  • server/utils/fleet_metrics.py — Redis 心跳聚合
  • server/infrastructure/database/fleet_metric_repo.py
  • server/background/heartbeat_flush.py — 采样 + 清理
  • server/infrastructure/database/migrations.py — 建表
  • server/api/servers.pyGET /api/servers/fleet-metrics
  • frontend/src/components/dashboard/DashboardFleetTrends.vue
  • frontend/src/pages/DashboardPage.vue
  • tests/test_fleet_metrics.py
  • docs/design/specs/2026-06-09-dashboard-24h-metrics-design.md

迁移 / 重启

  • 启动时 run_schema_migrations 自动建 fleet_metric_samples
  • 需重启 API;前端需 vite build

验证

pytest tests/test_fleet_metrics.py -q
cd frontend && npm run type-check && npx vite build

部署后约 10 分钟出现首条采样;满 24h 曲线更完整。