From 2c6b52f0ed18f3a9ad840704223d5263f53dcc37 Mon Sep 17 00:00:00 2001 From: Accusys Date: Sun, 18 Oct 2026 16:31:05 +0800 Subject: [PATCH] docs: add Monitor Dashboard Improvements recommendation for Studio team - Document new/enhanced API endpoints (worker_status, data-consistency) - UI improvement recommendations (empty state, worker health, consistency check) - Priority matrix and implementation guide - Files to modify list for Studio team --- ...nitor_Dashboard_Improvements_2026-10-18.md | 238 ++++++++++++++++++ 1 file changed, 238 insertions(+) create mode 100644 docs_v1.0/STUDIO_TEAM/Monitor_Dashboard_Improvements_2026-10-18.md diff --git a/docs_v1.0/STUDIO_TEAM/Monitor_Dashboard_Improvements_2026-10-18.md b/docs_v1.0/STUDIO_TEAM/Monitor_Dashboard_Improvements_2026-10-18.md new file mode 100644 index 00000000..85fc6711 --- /dev/null +++ b/docs_v1.0/STUDIO_TEAM/Monitor_Dashboard_Improvements_2026-10-18.md @@ -0,0 +1,238 @@ +# Monitor Dashboard Improvements - API & UI Recommendations + +**Date**: 2026-10-18 +**From**: Core Team +**To**: Studio Team +**Priority**: Medium + +--- + +## Overview + +The Core team has enhanced the Monitor API endpoints. This document provides recommendations for updating the Monitor dashboard UI to utilize the new API capabilities and improve user experience. + +--- + +## New/Updated API Endpoints + +### 1. GET `/api/v1/monitor/worker_status` (Enhanced) + +**New fields added**: + +| Field | Type | Description | +|-------|------|-------------| +| `worker_pid` | `u32` | Worker process PID (from `pgrep`) | +| `uptime_secs` | `u64` | System uptime (approximation) | +| `last_poll_at` | `Option` | Last job activity timestamp | +| `poll_interval_secs` | `u64` | Worker poll interval (default: 5) | +| `is_alive` | `bool` | Whether worker process is running | + +**Example Response**: +```json +{ + "cpu_percent": 50.0, + "gpu_percent": 0.0, + "memory_mb": 27526, + "memory_percent": 56.0, + "active_processors": 0, + "max_processors": 6, + "processors": [], + "worker_pid": 48844, + "uptime_secs": 1792311585, + "last_poll_at": null, + "poll_interval_secs": 5, + "is_alive": true +} +``` + +### 2. GET `/api/v1/file/:file_uuid/data-consistency` (New) + +**Purpose**: Check data consistency across storage layers. + +**Example Response**: +```json +{ + "file_uuid": "5a0aca42c06fa425d559b6af0caced12", + "tkg_nodes": 123, + "trace_profiles": 123, + "trace_dirs": 1881, + "qdrant_points": 1881, + "qdrant_unique_traces": 123, + "is_consistent": false, + "mismatches": ["tkg_nodes (123) != trace_dirs (1881)"] +} +``` + +### 3. Existing Endpoints (Unchanged) + +| Endpoint | Response | +|----------|----------| +| `GET /api/v1/monitor/queue_stats` | `{pending, running, completed, failed}` | +| `GET /api/v1/monitor/running_jobs` | `{jobs: [...]}` | +| `GET /api/v1/health` | `{status, worker_running, ...}` | + +--- + +## UI Improvement Recommendations + +### 1. Empty State Handling + +**Current Issue**: When `running_jobs` returns `[]`, the page shows blank content. + +**Recommendation**: +```vue + +
+
πŸ“­
+

No Active Jobs

+

All jobs are completed. New jobs will appear here when registered.

+ +
+``` + +### 2. Worker Health Indicator + +**New Component**: Add a worker status badge in the header. + +```vue +
+ + Worker {{ worker.is_alive ? 'Running' : 'Offline' }} + PID: {{ worker.worker_pid }} +
+``` + +**CSS**: +```css +.worker-status { + display: inline-flex; + align-items: center; + gap: 8px; + padding: 4px 12px; + border-radius: 16px; + font-size: 14px; +} +.worker-status.alive { + background: rgba(34, 197, 94, 0.1); + color: #22c55e; +} +.worker-status.dead { + background: rgba(239, 68, 68, 0.1); + color: #ef4444; +} +.status-dot { + width: 8px; + height: 8px; + border-radius: 50%; + background: currentColor; +} +``` + +### 3. Recent Completed Jobs Section + +**New Section**: Show last 5 completed jobs. + +```vue +
+

Recently Completed

+
    +
  • + {{ job.uuid.slice(0, 12) }}... + βœ“ Completed + {{ formatTime(job.completed_at) }} +
  • +
+
+``` + +**API**: Use `GET /api/v1/jobs?page=1&page_size=5&status=completed` (if available) or poll the queue stats for completed count changes. + +### 4. Data Consistency Checker + +**New Feature**: Add a "Check Consistency" button on file detail pages. + +```vue + + +
+

Data Consistency Report

+
    +
  • TKG Nodes: {{ consistencyResult.tkg_nodes }}
  • +
  • Trace Profiles: {{ consistencyResult.trace_profiles }}
  • +
  • Trace Dirs: {{ consistencyResult.trace_dirs }}
  • +
  • Qdrant Points: {{ consistencyResult.qdrant_points }}
  • +
+
+

Mismatches detected:

+
    +
  • {{ m }}
  • +
+
+
+``` + +### 5. Zombie Job Cleanup Button + +**New Admin Feature**: Add a button to clean up zombie jobs (Redis keys with no matching files). + +```vue + +``` + +**Implementation**: Call a new Core API endpoint `POST /api/v1/admin/cleanup-zombie-jobs` (needs to be added to Core). + +--- + +## Data Flow Diagram + +``` +β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” +β”‚ Browser │────▢│ Core API │────▢│ PostgreSQL β”‚ +β”‚ │◀────│ (port 3002) │◀────│ / Redis β”‚ +β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ + β”‚ + β”œβ”€β”€ GET /api/v1/monitor/queue_stats + β”œβ”€β”€ GET /api/v1/monitor/running_jobs + β”œβ”€β”€ GET /api/v1/monitor/worker_status (enhanced) + └── GET /api/v1/file/:uuid/data-consistency (new) +``` + +--- + +## Priority Matrix + +| Feature | Priority | Effort | Impact | +|---------|----------|--------|--------| +| Empty state handling | πŸ”΄ High | Low | High | +| Worker health indicator | 🟑 Medium | Low | Medium | +| Recent completed jobs | 🟑 Medium | Medium | Medium | +| Data consistency checker | 🟒 Low | Medium | Low | +| Zombie job cleanup | 🟒 Low | High | Low | + +--- + +## Files to Modify (Studio) + +| File | Changes | +|------|---------| +| `src/views/MonitorView.vue` | Add empty state, worker health badge | +| `src/components/WorkerStatus.vue` | New component for worker indicator | +| `src/components/ConsistencyReport.vue` | New component for data check | +| `src/stores/monitor.ts` | Add worker status polling | +| `src/api/monitor.ts` | Add new API methods | + +--- + +## Next Steps + +1. **Core Team**: Add `POST /api/v1/admin/cleanup-zombie-jobs` endpoint (if needed) +2. **Studio Team**: Review and implement UI changes based on priority +3. **Both**: Coordinate on API contract changes + +--- + +**Contact**: Core Team for API questions, Studio Team for UI implementation.