-
Notifications
You must be signed in to change notification settings - Fork 0
feat(ptui): Add system resources, latency trends, and help sections #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/dashboard-redesign
Are you sure you want to change the base?
Conversation
Co-authored-by: Camier <8348793+Camier@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enhances the PTUI dashboard with three major features: system resource monitoring, latency trend tracking, and an integrated help section. The dashboard now provides better observability while maintaining its lightweight, terminal-based design with optional dependencies for enhanced functionality.
- Added system resources panel showing CPU, memory, and disk usage with visual progress bars using psutil (optional)
- Implemented latency history tracking that displays trend indicators (↓=improving, ↑=degrading, →=stable) alongside service latencies
- Added Help section with keyboard shortcuts reference and feature availability status, accessible via '?' key
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| scripts/ptui_dashboard.py | Adds latency tracking functions, system resource monitoring with psutil integration, help panel rendering, and '?' keyboard shortcut handler |
| tests/unit/test_ptui_dashboard.py | Adds 17 new test cases covering latency tracking (recording, trends, edge cases), system resources (availability, value ranges), and new constants validation |
| docs/ptui-dashboard.md | Updates documentation to reflect new features including system resources panel, latency trends, help section, and '?' keyboard shortcut |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
scripts/ptui_dashboard.py
Outdated
| bar_width = min(30, width - 4) | ||
| filled = int((cpu_percent / 100) * bar_width) | ||
| bar = "█" * filled + "░" * (bar_width - filled) | ||
| safe_addstr(stdscr, y, left + 2, f"[{bar}]", width - 2, cpu_attr) | ||
| y += 1 | ||
| safe_addstr(stdscr, y, left + 2, f"{cpu_count} cores available", width - 2, curses.A_DIM) | ||
| y += 2 | ||
|
|
||
| # Memory Usage | ||
| memory_percent = resources.get("memory_percent", 0) | ||
| memory_used = resources.get("memory_used_gb", 0) | ||
| memory_total = resources.get("memory_total_gb", 0) | ||
| mem_attr = curses.color_pair(1) if memory_percent < 80 else curses.color_pair(2) | ||
| safe_addstr( | ||
| stdscr, y, left, | ||
| f"Memory: {memory_used:.1f}GB / {memory_total:.1f}GB ({memory_percent:.1f}%)", | ||
| width, | ||
| mem_attr | curses.A_BOLD, | ||
| ) | ||
| y += 1 | ||
| filled = int((memory_percent / 100) * bar_width) | ||
| bar = "█" * filled + "░" * (bar_width - filled) | ||
| safe_addstr(stdscr, y, left + 2, f"[{bar}]", width - 2, mem_attr) | ||
| y += 2 | ||
|
|
||
| # Disk Usage | ||
| disk_percent = resources.get("disk_percent", 0) | ||
| disk_used = resources.get("disk_used_gb", 0) | ||
| disk_total = resources.get("disk_total_gb", 0) | ||
| disk_attr = curses.color_pair(1) if disk_percent < 90 else curses.color_pair(2) | ||
| safe_addstr( | ||
| stdscr, y, left, | ||
| f"Disk: {disk_used:.1f}GB / {disk_total:.1f}GB ({disk_percent:.1f}%)", | ||
| width, | ||
| disk_attr | curses.A_BOLD, | ||
| ) | ||
| y += 1 | ||
| filled = int((disk_percent / 100) * bar_width) | ||
| bar = "█" * filled + "░" * (bar_width - filled) | ||
| safe_addstr(stdscr, y, left + 2, f"[{bar}]", width - 2, disk_attr) |
Copilot
AI
Nov 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable bar_width is computed once at line 716 in the CPU section and then implicitly reused for memory (line 736) and disk (line 753) progress bars. This creates an implicit dependency that could break if the code is refactored. Consider either: (1) computing bar_width once before the CPU section, or (2) computing it separately for each progress bar to make the code more self-contained and maintainable.
…cpu_percent Co-authored-by: Camier <8348793+Camier@users.noreply.github.com>
Implements enhancements from the PTUI dashboard roadmap: system resource monitoring, latency trend tracking, and integrated help.
Changes
New Dashboard Sections
psutil)?keyLatency Trend Indicators
Tracks service latency history and displays trend in Service Overview:
↓improving,↑degrading,→stableConfiguration Constants
TREND_RECENT_SAMPLES,TREND_MIN_SAMPLES,TREND_IMPROVEMENT_THRESHOLD,TREND_DEGRADATION_THRESHOLDPROGRESS_BAR_MAX_WIDTHcpu_percent(interval=None)to avoid UI delayTests
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.