-
Notifications
You must be signed in to change notification settings - Fork 5
feat: Add comprehensive probe history tracking and enhanced TUI display #51
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…rchitecture - Implement ring buffer-based history management for each target - Add detailed probe information collection for all probe types (ICMP, HTTP, DNS, NTP) - Refactor stats module to use interface-based design for better abstraction - Enhance probe details with protocol-specific information: * ICMP: sequence, TTL, data size * HTTP: status code, response size, headers, redirects * DNS: response code, answer count, server details * NTP: stratum, time offset, precision * TCP: connection-only verification (no additional details) - Add MetricsReader interface to decouple UI from internal implementation - Extend history functionality with consecutive failure/success tracking - Add success rate calculation within specified time periods - Update TUI components to use interface-based metrics access - Maintain backward compatibility for existing functionality This enhancement enables advanced monitoring capabilities including trend analysis, detailed probe diagnostics, and improved failure pattern detection.
- Add 'v' key toggle for showing/hiding detailed host information panel - Implement 2-pane layout: host list (left) + detail panel (right) - Display probe history (last 10 entries) with timestamps and probe-specific details - Show basic statistics: RTT metrics, success/failure counts, packet loss - Support all probe types: ICMP (seq/ttl/size), HTTP (status/size), DNS (code/answers), NTP (stratum/offset), TCP (connection) - Fix TCP detail display issue by passing metrics objects directly instead of hostname strings - Default to single-pane view for simplicity, toggle detail view on demand
- Remove redundant host name from detail view content (already shown in title bar) - Display error messages in history Details column for failed probes - Fix ICMP details to show only implemented fields (seq, size) instead of unimplemented TTL - Add fallback probe type labels when detailed information is unavailable - Simplify DNS details display by removing server information for cleaner layout - Enhance history readability with context-aware Details column (errors vs probe specifics)
- Fix infinite loop when applying filters by removing immediate Update() call - Add selection change detection to prevent redundant callback executions - Simplify DNS details format by removing redundant domain/server information - Add first DNS answer value display with configurable truncation (35 chars) - Improve protocol indication (TCP only when used, UDP implied by absence) - Extract DNS answer parsing logic into dedicated function for reusability
- Color-code basic statistics with status-aware colors: * Success count: green (with data) / red (zero) * Failed count: red (with failures) / white (zero) * Loss rate: green (<10%) / yellow (10-50%) / red (>50%) * Labels: consistent cyan coloring - Enhance history section with visual hierarchy: * Section titles in yellow for prominence * Headers in cyan for structure * Timestamps in gray for subtlety * Status indicators: green (OK) / red (FAIL) * Error messages highlighted in red - Improve overall readability and instant problem identification
- Updated metrics sorting logic to use `stats.Fail` instead of `stats.Success` to highlight failing endpoints by default. - Updated UI state default `sortKey` to `stats.Fail` and changed `ascending` to `false` to show most problematic rows at the top. - Adjusted `ToGoPrettyTable` to handle wide character rendering correctly by disabling East Asian width override with `text.OverrideRuneWidthEastAsianWidth(false)`. - Minor formatting improvements in `ToTviewTable()` for consistent code style.
- Fix type conversion issues in test files to use MetricsReader interface - Update test expectations to match color-coded formatter output - Fix default sort key test to use Fail instead of Success - Ensure all tests pass with new interface implementation
ff0920e to
04346f5
Compare
- Replace all Japanese comments with clear English equivalents - Update comments in prober package (details.go, dns.go, http.go, icmp.go, ntp.go, tcp.go) - Update comments in stats package (history.go, interface.go, manager.go, metric.go, history_test.go) - Maintain original meaning and context in all translations - Fix minor ICMP variable naming issues discovered during translation - All functionality remains unchanged, only comment language updated
- Remove unnecessary fields from ICMPDetails (TTL, ID, DataSize, SourceIP, PayloadMatch) - Add actual payload content display with formatted output (max 32 chars) - Remove ICMP Packet Details section from Host Details view - Simplify Recent History display with essential packet information - Update tests to reflect simplified structure This change focuses on showing only the most relevant ICMP information while maintaining detailed packet analysis in the Recent History section.
- Fix v key showing "Select a host to view details" by adding GetSelectedMetrics() method - Add selection synchronization in showDetailView() to display current host details - Add border containers to both Host List and Host Details panels - Update panel architecture to use Flex containers with borders - Fix test expectations for container-based panel architecture
… dependencies - Split MetricsManagerInterface into focused interfaces: - BasicMetrics: Basic statistics for display/sorting - DetailedMetrics: Extended metrics with history - MetricsProvider: External API for metrics access - MetricsSystemManager: System-level operations - MetricsEventRecorder: Internal event recording - Replace concrete *stats.MetricsManager with appropriate interfaces: - UI components now use MetricsProvider interface - Command layer uses MetricsManagerInterface - Each component only depends on methods it actually uses - Update MetricsManager implementation: - Separate internal getMetrics() from external GetMetrics() - Update method signatures to match interface contracts - Maintain backward compatibility with MetricsManagerInterface This change improves code maintainability by enforcing interface segregation principle and reducing coupling between components.
Phase 3-6 final optimization: - Remove unused interface methods (GetHistorySince, GetAllTargets, etc.) - Consolidate MetricsReader and DetailedMetrics interfaces - Eliminate unused dependencies in HostDetailPanel - Optimize interface usage in setupPanels to use MetricsProvider - Simplify method name: SortByWithReader → SortBy Interface cleanup results: - BasicMetrics: 12 methods (core statistics) - MetricsReader: 16 methods (BasicMetrics + history/analysis) - MetricsProvider: 2 methods (SortBy, GetMetrics) - MetricsSystemManager: 1 method (ResetAllMetrics) - MetricsEventRecorder: 3 methods (Success, Failed, Sent) - MetricsManagerInterface: Clean composition of above interfaces This completes the interface segregation principle implementation, removes dead code, and provides cleaner, more intuitive method names while maintaining full backward compatibility.
- Update metric_test.go to use Getter methods instead of direct field access - Replace stats.MetricsReader with stats.Metrics interface in test files - Fix type assertions and method calls to work with new interface structure - All tests now pass after interface refactoring
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Key Features
Technical Changes
internal/stats/history.go,internal/stats/interface.go,internal/prober/details.goTest Coverage
internal/stats/history_test.go)Breaking Changes