File size: 6,425 Bytes
b190b45 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
# System Monitor - Enhanced Animated Visualization
## Overview
The System Monitor provides a beautiful, real-time animated visualization of your entire system architecture. It's like looking at your system from above with a bird's-eye view, showing all components and data flow between them.
## Features
### π¨ Visual Components
1. **API Server (Center)** - The main FastAPI server
- Green pulsing glow when healthy
- Central hub for all communications
- Server icon with status indicator
2. **Database (Right)** - SQLite database
- Blue when online, red when offline
- Shows data persistence operations
- Database cylinder icon
3. **Clients (Bottom)** - Multiple client connections
- Purple nodes representing different clients
- Monitor icons showing active connections
- Receives final responses
4. **Data Sources (Top Arc)** - External API sources
- Orange/yellow nodes in an arc formation
- Radio wave icons for data sources
- Shows active/inactive status
5. **AI Models (Left Side)** - Machine learning models
- Pink nodes for AI/ML models
- Neural network icons
- Status indicators for model health
### π Animated Data Flow
The system shows complete request/response cycles with beautiful animations:
1. **Request Phase (Purple)**
- Client β Server
- Arrow indicator on packet
2. **Processing Phase (Cyan)**
- Server β Data Source/AI Model/Database
- Shows where data is being fetched
3. **Response Phase (Green)**
- Data Source/AI Model/Database β Server
- Checkmark indicator on packet
4. **Final Response (Bright Green)**
- Server β Client
- Particle explosion effect on arrival
### β¨ Visual Effects
- **Pulsing Glows** - All nodes have animated glowing effects
- **Animated Connections** - Dashed lines flow between active nodes
- **Packet Trails** - Data packets leave glowing trails
- **Particle Effects** - Burst animations when packets arrive
- **Grid Background** - Subtle grid pattern for depth
- **Gradient Backgrounds** - Beautiful dark theme with gradients
### π Real-Time Stats
**Top-Left Legend:**
- Request (Purple)
- Processing (Cyan)
- Response (Green)
**Top-Right Stats Panel:**
- Active Packets count
- Data Sources count
- AI Models count
- Connected Clients count
### π Data Updates
The monitor updates via two methods:
1. **WebSocket** - Real-time updates every 2 seconds
2. **HTTP Polling** - Fallback polling every 5 seconds
### π― Status Indicators
Each node shows its status:
- **Green dot** - Online/Healthy
- **Red dot** - Offline/Failed
- **Pulsing glow** - Active processing
## Technical Details
### Canvas Size
- Default: 700px height
- Responsive: Adjusts for different screen sizes
- Dark theme with gradient background
### Animation System
- 60 FPS smooth animations
- Easing functions for natural movement
- Trail effects with fade-out
- Particle system for visual feedback
### Node Layout
- **Server**: Center (x: 50%, y: 50%)
- **Database**: Right of server (+200px)
- **Clients**: Bottom row (3 clients, 150px spacing)
- **Sources**: Top arc (250px radius)
- **AI Models**: Left column (80px spacing)
### Packet Flow Logic
```
Client Request
β
API Server
β
[Data Source / AI Model / Database]
β
API Server
β
Client Response (with particle effect)
```
### Demo Mode
When no real requests are active, the system generates demo packets every 3 seconds to showcase the animation system:
- `/api/market/price`
- `/api/models/sentiment`
- `/api/service/rate`
- `/api/monitoring/status`
- `/api/database/query`
## API Integration
### Endpoints Used
- `GET /api/monitoring/status` - System status
- `WS /api/monitoring/ws` - Real-time WebSocket
- `GET /api/monitoring/sources/detailed` - Source details
- `GET /api/monitoring/requests/recent` - Recent requests
### Data Structure
```javascript
{
database: { online: true },
ai_models: {
total: 10,
available: 8,
failed: 2,
models: [...]
},
data_sources: {
total: 15,
active: 12,
pools: 3,
sources: [...]
},
recent_requests: [...],
stats: {
active_sources: 12,
requests_last_minute: 45,
requests_last_hour: 2500
}
}
```
## Customization
### Colors
You can customize colors in the code:
```javascript
// Node colors
server: '#22c55e' // Green
database: '#3b82f6' // Blue
client: '#8b5cf6' // Purple
source: '#f59e0b' // Orange
aiModel: '#ec4899' // Pink
// Packet colors
request: '#8b5cf6' // Purple
processing: '#22d3ee' // Cyan
response: '#22c55e' // Green
final: '#10b981' // Bright Green
```
### Canvas Size
Adjust in CSS:
```css
.network-canvas-container {
height: 700px; /* Change this value */
}
```
### Animation Speed
Adjust packet speed:
```javascript
speed: 0.015 // Lower = slower, Higher = faster
```
### Demo Packet Frequency
```javascript
setInterval(() => {
this.createPacket({ endpoint: randomEndpoint });
}, 3000); // Change interval (milliseconds)
```
## Browser Compatibility
- β
Chrome/Edge (Chromium)
- β
Firefox
- β
Safari
- β
Opera
Requires HTML5 Canvas support.
## Performance
- Optimized for 60 FPS
- Automatic cleanup of old packets
- Efficient canvas rendering
- Pauses updates when tab is hidden
## Troubleshooting
### Canvas not showing
- Check browser console for errors
- Ensure canvas element exists in DOM
- Verify JavaScript is enabled
### No animations
- Check WebSocket connection status
- Verify API endpoints are accessible
- Look for rate limiting (429 errors)
### Slow performance
- Reduce canvas size
- Decrease packet generation frequency
- Close other browser tabs
## Future Enhancements
- [ ] Click on nodes to see details
- [ ] Zoom and pan controls
- [ ] Export visualization as image
- [ ] Custom color themes
- [ ] Sound effects for packets
- [ ] 3D visualization mode
- [ ] Historical playback
- [ ] Alert animations for errors
## Credits
Built with β€οΈ using:
- HTML5 Canvas API
- WebSocket API
- FastAPI backend
- Modern JavaScript (ES6+)
---
**Version**: 2.0
**Last Updated**: 2025-12-08
**Author**: Crypto Monitor Team
|