Skip to content

Trafficgraphwidget knots #104

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

Open
wants to merge 1 commit into
base: 28.x-knots
Choose a base branch
from

Conversation

rebroad
Copy link

@rebroad rebroad commented Apr 15, 2025

This PR improves the network traffic graph widget in the Debug window to provide:

  1. Multiple time range options (from 5 minutes to 28 days)
  2. Data persistence between sessions
  3. Interactive visualization features including tooltips and logarithmic scaling

Motivation

The existing network traffic graph has limited utility with its fixed time range and lack of historical data preservation. This enhancement allows users to:

  • Analyze network traffic patterns over different timeframes
  • Preserve historical traffic data between session restarts
  • Interact with the graph to get specific data points
  • Better visualize varying traffic volumes with logarithmic scaling

These improvements are valuable for:

  • Network debugging and troubleshooting
  • Understanding Bitcoin Core's network behaviour
  • Monitoring traffic patterns for optimization
  • Research purposes

Implementation

The implementation preserves all existing functionality while adding new features:

  • Added a pre-configured timeframe selection (13 different timeframes)
  • Implemented traffic data serialization and deserialization
  • Enhanced the visualization with interactive features
  • Improved tooltip information with precise timestamps and traffic rates

Supporting changes:

  • Added formatBytesps function for a prettier display of traffic rates
  • Added FormatISO8601Time for better time display
  • Added setTotalBytes functionality to restore network statistics properly

Testing

Tested on Linux with various network conditions. The new functionality can be exercised by:

  1. Using the slider (or arrow keys) to select different time ranges
  2. Restarting the application to verify data persistence
  3. Clicking on the graph to toggle between linear and logarithmic scales
  4. Hovering over data points to view detailed information

Documentation

The changes are mostly self-documenting through the UI and are constrained to the Qt interface without affecting core functionality.

Compatibility

This PR maintains compatibility with existing functionality. The data persistence file uses proper serialization versioning to allow for future format changes if needed.

@rebroad
Copy link
Author

rebroad commented Apr 15, 2025

Just saw your comments in the PR for core. Happy to split into smaller PRs although for knots, there are fewer changes given much of the functionality is already present.

@rebroad rebroad force-pushed the trafficgraphwidget-knots branch from 6232958 to e50f6f7 Compare April 16, 2025 08:36
@rebroad rebroad force-pushed the trafficgraphwidget-knots branch from e50f6f7 to 6807d66 Compare April 29, 2025 16:08
…persistence

This commit significantly improves the network traffic graph widget with:

1. Multiple timeframe support - View traffic data across different time
   periods (5 minutes to 28 days) using an enhanced slider interface

2. Traffic data persistence - Save and restore traffic information
   between sessions, preserving historical traffic patterns

3. Interactive visualization features:
   - Logarithmic scale toggle (mouse click) for better visualization of
     varying traffic volumes
   - Interactive tooltips showing detailed traffic information at specific points
   - Yellow highlight indicators for selected data points

4. Smooth transitions between different time ranges with animated scaling

These improvements allow users to better monitor and analyze network
traffic patterns over time, which is especially useful for debugging
connectivity issues or understanding network behavior under different
conditions.

The implementation includes proper thread-safety considerations and
handles edge cases like time jumps or missing data appropriately.
@rebroad rebroad force-pushed the trafficgraphwidget-knots branch from 6807d66 to 592a78b Compare April 30, 2025 21:14
@rebroad rebroad marked this pull request as ready for review April 30, 2025 21:15
@luke-jr
Copy link
Member

luke-jr commented May 15, 2025

Were you going to split it into multiple commits?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants