-
Notifications
You must be signed in to change notification settings - Fork 525
Description
Summary
Add a new "DHT Provide" tab to the Diagnostics screen that provides a GUI equivalent of ipfs provide stat -a --compact, allowing users to monitor the health and progress of the Sweep provide system introduced in Kubo v0.38 and enabled by default in v0.39.
This screen would give node operators a one-glance overview of their DHT provide operations, making it easier to understand content announcement status, diagnose issues, and tune configuration.
Background
Kubo v0.39 introduced the DHT Sweep provider as the default (Provide.DHT.SweepEnabled=true). This system:
- Divides the DHT keyspace into regions and systematically sweeps through them
- Batches CIDs allocated to the same DHT servers, dramatically reducing DHT lookups
- Exposes detailed statistics via
ipfs provide statand the RPC endpoint/api/v0/provide/stat
Currently, users must use the CLI (watch ipfs provide stat --all --compact) to monitor this. A Web UI integration would make this accessible to users who prefer graphical interfaces.
Reference documentation:
Proposed Implementation
Note
Below are my personal notes with general direction I would take, but feel free to change it, go in different direction if you feel there is more ergonomic/friendly way of showing this information.
Location
New tab "DHT Provide" within the existing Diagnostics screen (alongside existing diagnostic tools).
Data Source
- RPC Endpoint:
POST /api/v0/provide/stat - Flags to support:
--allequivalent for complete metrics,--lanfor LAN DHT stats in dual-DHT configurations. Important: most of the time users are interested in WAN DHT and ability to switch to LAN DHT should be a very unobtrusive checkbox somewhere in the UI. It should be easy to ignore, or also valid to just NOT show option to use `--lan` and say that GUI only shows WAN DHT and that is all, and for LAN use CLI.
Key UI Components
1. Reprovide Interval Progress Bar (Screen-wide)
A visual representation of Provide.DHT.Interval divided into region batches:
┌───────────────────────────────────────────────────────────────────────┐
│ Reprovide Cycle Progress [72% Complete] │
├───────────────────────────────────────────────────────────────────────┤
│ ████████████████████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░ │
│ ▲ completed regions ▲ current batch remaining │
└───────────────────────────────────────────────────────────────────────┘
Started: 2h 15m ago ETA: 52m remaining
2. Current Batch Information Panel
Display information about the active batch being processed:
| Metric | Description |
|---|---|
| Current Region | The DHT keyspace region currently being processed |
| Batch Size | Number of CIDs in the current batch |
| Pending CIDs | CIDs waiting in queue to be provided |
| Provide Queue | Total items in the provide queue |
3. Worker Utilization Panel
Visual representation of worker activity:
Workers: 8/16 active (50% utilization)
├── Periodic Workers: 4/8 busy
├── On-demand Workers: 4/8 busy
└── Max Connections/Worker: 20
Include a visual indicator (progress bars or activity dots) for each worker pool.
4. Statistics Summary
Key metrics from ipfs provide stat --all:
- Network Stats: Connectivity status, peer count for DHT operations
- Operation Rates: Provides/second, success rate, error rate
- Queue Sizes: Periodic queue, on-demand queue, total pending
- Cycle Information: Current cycle start time, last completion time, estimated completion
5. Alerts/Warnings Section
Display any warnings detected by Kubo's slow reprovide monitoring:
- Queue growth alerts
- Worker saturation warnings
- Configuration recommendations (e.g., "Consider increasing
Provide.DHT.MaxWorkers")
Refresh Behavior
- Default: Auto-refresh every 60 seconds
- Manual: "Refresh Now" button for on-demand updates
- Optional: Configurable refresh interval or pause auto-refresh
Error Handling
Display a clear error message when:
-
Sweep mode not enabled:
⚠️ DHT Sweep Provider Not EnabledThis screen requires Provide.DHT.SweepEnabled=true in your Kubo configuration.
The Sweep provider is enabled by default in Kubo v0.39+.To enable: ipfs config --json Provide.DHT.SweepEnabled true
-
Legacy provider mode: When
SweepEnabled=false, show basic stats (if available) with a note that detailed statistics require the Sweep provider. -
RPC endpoint unavailable: Handle cases where the endpoint is not available (older Kubo versions).
Dependencies
js-kubo-rpc-client
Support for ipfs.provide.stat() RPC may need to be added to js-kubo-rpc-client if not already present.
Suggested API:
interface ProvideStatOptions { all?: boolean; // Include all detailed stats lan?: boolean; // Show LAN DHT stats instead of WAN // ... other flags as needed }
ipfs.provide.stat(options?: ProvideStatOptions): Promise<ProvideStats>
Related issue/PR needed in: https://github.com/ipfs/js-kubo-rpc-client
Design Suggestions
Visual Mockup Concept
┌──────────────────────────────────────────────────────────────────────────┐
│ Diagnostics > DHT Provide [Refresh] [⟳ Auto: 60s] │
├──────────────────────────────────────────────────────────────────────┤
│ │
│ REPROVIDE CYCLE Cycle #47 │
│ ████████████████████████████████████████░░░░░░░░░░░░░░░ 72% complete │
│ Started 2h 15m ago • ETA 52m • 847,293 / 1,176,518 CIDs provided │
│ │
├──────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────┐ ┌─────────────────────────┐ │
│ │ CURRENT BATCH │ │ QUEUE STATUS │ │
│ │ │ │ │ │
│ │ Region: 0x4A... │ │ Periodic: 12,847 │ │
│ │ Batch: 1,247 CIDs │ │ On-demand: 156 │ │
│ │ Progress: 834/1,247 │ │ Total: 13,003 │ │
│ │ Rate: 42 CIDs/sec │ │ │ │
│ └─────────────────────────┘ └─────────────────────────┘ │
│ │
│ ┌─────────────────────────┐ ┌─────────────────────────┐ │
│ │ WORKERS │ │ NETWORK │ │
│ │ │ │ │ │
│ │ Active: 12/16 (75%) │ │ Status: ● Connected │ │
│ │ Periodic: 8/8 ████ │ │ DHT Peers: 847 │ │
│ │ On-demand: 4/8 ████░ │ │ Provides/hr: 15,247 │ │
│ │ │ │ Success: 99.2% │ │
│ └─────────────────────────┘ └─────────────────────────┘ │
│ │
│ ┌──────────────────────────────────────────────────────────────────┐ │
│ │ ⚠️ Workers at 75% capacity. If queue grows, consider increasing │ │
│ │ Provide.DHT.MaxWorkers (current: 16) │ │
│ └──────────────────────────────────────────────────────────────────┘ │
│ │
└──────────────────────────────────────────────────────────────────────────┘
Additional Considerations
- Responsive design: Ensure the layout works on various screen sizes
- Dark/light mode: Support existing theme system
- Accessibility: Proper ARIA labels for progress indicators
- Tooltips: Add helpful tooltips explaining each metric for newcomers
- Documentation link: Link to the Provide Stats documentation for users wanting more detail
Acceptance Criteria
- New "DHT Provide" tab appears in Diagnostics screen
- Screen displays all key metrics from
ipfs provide stat --all - Visual progress bar shows reprovide cycle progress
- Worker utilization is displayed graphically
- Auto-refresh every 60 seconds (default)
- Manual refresh button works
- Clear error message when Sweep mode not enabled
- Graceful handling when RPC endpoint unavailable
- Works with both WAN and LAN DHT (toggle or tabs)
Related
- Kubo PR enabling sweep by default: https://github.com/feat: enable DHT Provide Sweep by default kubo#10955
- Provide stats implementation: https://github.com/provider: stats libp2p/go-libp2p-kad-dht#1144
- js-kubo-rpc-client: https://github.com/ipfs/js-kubo-rpc-client (may need
/api/v0/provide/statsupport)