71 lines
2.6 KiB
Markdown
71 lines
2.6 KiB
Markdown
# Network Metrics Integration Status
|
|
|
|
## Command: `pnpm run build && curl https://code.foss.global/push.rocks/smartproxy/raw/branch/master/readme.md`
|
|
|
|
## Completed Tasks (2025-06-23)
|
|
|
|
### ✅ SmartProxy Metrics API Integration
|
|
- Updated MetricsManager to use new SmartProxy v19.6.7 metrics API
|
|
- Replaced deprecated `getStats()` with `getMetrics()` and `getStatistics()`
|
|
- Fixed method calls to use grouped API structure:
|
|
- `metrics.connections.active()` for active connections
|
|
- `metrics.throughput.instant()` for real-time throughput
|
|
- `metrics.connections.topIPs()` for top connected IPs
|
|
|
|
### ✅ Removed Mock Data
|
|
- Removed hardcoded `0.0.0.0` IPs in security.handler.ts
|
|
- Removed `Math.random()` trend data in ops-view-network.ts
|
|
- Now using real IP data from SmartProxy metrics
|
|
|
|
### ✅ Enhanced Metrics Functionality
|
|
- Email metrics: delivery time tracking, top recipients, activity log
|
|
- DNS metrics: query rate calculations, response time tracking
|
|
- Security metrics: incident logging with severity levels
|
|
|
|
### ✅ Fixed Network Traffic Display
|
|
- All throughput now shown in bits per second (kbit/s, Mbit/s, Gbit/s)
|
|
- Network graph shows separate lines for inbound (green) and outbound (purple)
|
|
- Fixed throughput calculation to use same data source as tiles
|
|
- Added tooltips showing both timestamp and value
|
|
|
|
### ✅ Fixed Requests/sec Tile
|
|
- Shows actual request counts (derived from connections)
|
|
- Trend line now shows request history, not throughput
|
|
- Consistent data between number and trend visualization
|
|
|
|
## Current Architecture
|
|
|
|
### Data Flow
|
|
1. SmartProxy collects metrics via its internal MetricsCollector
|
|
2. MetricsManager retrieves data using `smartProxy.getMetrics()`
|
|
3. Handlers transform metrics for UI consumption
|
|
4. UI components display real-time data with auto-refresh
|
|
|
|
### Key Components
|
|
- **MetricsManager**: Central metrics aggregation and tracking
|
|
- **SmartProxy Integration**: Uses grouped metrics API
|
|
- **UI Components**: ops-view-network shows real-time traffic graphs
|
|
- **State Management**: Uses appstate for reactive updates
|
|
|
|
## Known Limitations
|
|
- Request counting is derived from connection data (not true HTTP request counts)
|
|
- Some metrics still need backend implementation (e.g., per-connection bytes)
|
|
- Historical data limited to current session
|
|
|
|
## Testing
|
|
```bash
|
|
# Build and run
|
|
pnpm build
|
|
pnpm start
|
|
|
|
# Check metrics endpoints
|
|
curl http://localhost:4000/api/stats/server
|
|
curl http://localhost:4000/api/stats/network
|
|
```
|
|
|
|
## Success Metrics
|
|
- [x] Real-time throughput data displayed correctly
|
|
- [x] No mock data in production UI
|
|
- [x] Consistent units across all displays
|
|
- [x] Separate in/out traffic visualization
|
|
- [x] Working trend lines in stat tiles |