Files
Nexus/docs/design/plans/2026-06-09-dashboard-24h-metrics.md
T
Nexus Agent 664efb9ed5 feat(dashboard): add 24h fleet CPU/mem/disk trends with v-sparkline.
Sample fleet averages every heartbeat flush into fleet_metric_samples;
expose GET /api/servers/fleet-metrics and Dashboard sparkline card (B-02).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-09 07:24:57 +08:00

901 B
Raw Blame History

B-02 Dashboard 24h 趋势 — 实施计划

文件清单

文件
Domain server/domain/models/__init__.pyFleetMetricSample
Infra server/infrastructure/database/fleet_metric_repo.py
Background server/background/heartbeat_flush.py — 采样 + purge
API server/api/servers.pyGET /fleet-metrics
迁移 server/infrastructure/database/migrations.py
前端 frontend/src/components/dashboard/DashboardTrendChart.vue
前端 frontend/src/pages/DashboardPage.vue
测试 tests/test_fleet_metrics.py

步骤

  1. 建表迁移 + ORM
  2. repoinsert_sample / list_since / purge_older_than
  3. heartbeat_flush 末尾聚合 Redis 并 insert
  4. API + Pydantic 响应
  5. SVG 图表组件 + Dashboard 挂载
  6. pytest + changelog + audit

回滚

  • 删除 API 与前端卡片即可;表可保留无影响。