Skip to content

Commit 9bf362f

Browse files
Yaniv Ben HemoYaniv Ben Hemo
authored andcommitted
Auto-commit: 2025-07-29 21:43:14
1 parent b247854 commit 9bf362f

File tree

16 files changed

+2816
-1
lines changed

16 files changed

+2816
-1
lines changed

dashboard/README.md

Lines changed: 321 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,321 @@
1+
# 🚀 Kafka Dashboard
2+
3+
Interactive web dashboard for monitoring and analyzing Kafka cluster health and performance metrics.
4+
5+
## 📊 Features
6+
7+
- **Real-time Health Monitoring** - Live cluster health score and status indicators
8+
- **Interactive Charts** - Plotly-powered visualizations with hover details and zoom
9+
- **Health Checks Analysis** - Detailed breakdown of all health check results
10+
- **Topics Overview** - Partition distribution, replication factors, and topic analytics
11+
- **Consumer Groups Monitoring** - Active/inactive groups and member status
12+
- **Broker Information** - Cluster metadata and broker details
13+
- **Auto-refresh** - Automatically updates every 30 seconds
14+
- **Responsive Design** - Works on desktop, tablet, and mobile devices
15+
16+
## 🎯 Screenshots
17+
18+
### Main Dashboard
19+
20+
- Health score gauge with color-coded status
21+
- Metrics cards showing key cluster statistics
22+
- Distribution charts for topics and consumer groups
23+
24+
### Health Checks
25+
26+
- Comprehensive table of all health check results
27+
- Color-coded status indicators (✅ Passed, ❌ Failed, ⚠️ Warning)
28+
- Recommendations for each check
29+
30+
## 🛠️ Installation
31+
32+
### Prerequisites
33+
34+
- Python 3.8+
35+
- Kafka analysis reports (generated by the main analyzer)
36+
37+
### Quick Start
38+
39+
1. **Install dependencies:**
40+
41+
```bash
42+
cd dashboard
43+
pip install -r requirements.txt
44+
```
45+
46+
2. **Generate analysis data (from parent directory):**
47+
48+
```bash
49+
cd ..
50+
npx superstream-kafka-analyzer --config kraft-config.json
51+
```
52+
53+
3. **Run dashboard:**
54+
55+
```bash
56+
cd dashboard
57+
python run_dashboard.py
58+
```
59+
60+
4. **Open browser:**
61+
```
62+
http://localhost:8050
63+
```
64+
65+
### Advanced Installation
66+
67+
```bash
68+
# Install with auto-dependency installation
69+
python run_dashboard.py --install
70+
71+
# Run on different port
72+
python run_dashboard.py --port 8080
73+
74+
# Use custom data directory
75+
python run_dashboard.py --data-dir /path/to/kafka-reports
76+
77+
# Run in debug mode
78+
python run_dashboard.py --debug
79+
80+
# Bind to all interfaces (accessible from other machines)
81+
python run_dashboard.py --host 0.0.0.0
82+
```
83+
84+
## 📁 Project Structure
85+
86+
```
87+
dashboard/
88+
├── app.py # Main dashboard application
89+
├── run_dashboard.py # Launcher script with dependency checking
90+
├── requirements.txt # Python dependencies
91+
├── README.md # This file
92+
├── components/
93+
│ ├── charts.py # Chart generation components
94+
│ └── layout.py # UI layout components
95+
├── utils/
96+
│ └── data_loader.py # Data loading and processing utilities
97+
└── assets/ # Static assets (CSS, images)
98+
```
99+
100+
## 🔧 Configuration
101+
102+
### Data Directory
103+
104+
The dashboard looks for analysis files in these locations (in order):
105+
106+
1. `./kafka-analysis` (current directory)
107+
2. `../kafka-analysis` (parent directory)
108+
3. `../../kafka-analysis` (grandparent directory)
109+
4. `~/kafka-analysis` (home directory)
110+
111+
### File Format
112+
113+
The dashboard expects JSON files with this naming pattern:
114+
115+
```
116+
kafka-analysis-{timestamp}.json
117+
```
118+
119+
## 📊 Dashboard Sections
120+
121+
### 1. **Metrics Cards**
122+
123+
- Total Brokers
124+
- Total Topics
125+
- Total Partitions
126+
- Consumer Groups
127+
- Active Groups
128+
- Average Partitions per Topic
129+
130+
### 2. **Health Score Gauge**
131+
132+
- Overall cluster health percentage
133+
- Color-coded indicator (Red < 70%, Yellow 70-90%, Green > 90%)
134+
- Delta from target (90%)
135+
136+
### 3. **Health Checks Summary**
137+
138+
- Bar chart showing passed/failed/warning counts
139+
- Interactive tooltips with details
140+
141+
### 4. **Topics Distribution**
142+
143+
- Pie chart of user vs internal topics
144+
- Total count in center
145+
146+
### 5. **Partitions per Topic**
147+
148+
- Bar chart showing partition distribution
149+
- Excludes internal topics for clarity
150+
151+
### 6. **Consumer Groups Status**
152+
153+
- Pie chart of active vs inactive groups
154+
- Helps identify unused consumer groups
155+
156+
### 7. **Replication Factor Distribution**
157+
158+
- Bar chart showing RF distribution across topics
159+
- Helps identify replication inconsistencies
160+
161+
### 8. **Cluster Information Card**
162+
163+
- Vendor information
164+
- Cluster ID and controller
165+
- Last analysis timestamp
166+
- Broker details with badges
167+
168+
### 9. **Detailed Health Checks Table**
169+
170+
- Comprehensive table of all health checks
171+
- Sortable and filterable columns
172+
- Color-coded rows by status
173+
- Recommendations for each check
174+
175+
## 🔄 Data Refresh
176+
177+
### Automatic Refresh
178+
179+
- Dashboard auto-refreshes every 30 seconds
180+
- Loads the latest analysis file automatically
181+
- Updates timestamp in top-right corner
182+
183+
### Manual Refresh
184+
185+
- Click "🔄 Refresh Now" button
186+
- Immediately loads latest data
187+
- Useful for testing or immediate updates
188+
189+
## 🎨 Customization
190+
191+
### Themes
192+
193+
The dashboard uses Bootstrap themes and can be customized by modifying:
194+
195+
- `external_stylesheets` in `app.py`
196+
- Custom CSS in the `app.index_string`
197+
198+
### Charts
199+
200+
Chart appearance can be modified in `components/charts.py`:
201+
202+
- Colors and styling
203+
- Chart types and layouts
204+
- Hover templates and annotations
205+
206+
### Layout
207+
208+
UI components can be customized in `components/layout.py`:
209+
210+
- Card designs and layouts
211+
- Metrics and badges
212+
- Table styling
213+
214+
## 🐛 Troubleshooting
215+
216+
### Common Issues
217+
218+
**No data available:**
219+
220+
```bash
221+
# Generate analysis reports first
222+
cd /path/to/kafka-analyzer
223+
npx superstream-kafka-analyzer --config config.json
224+
```
225+
226+
**Dependencies missing:**
227+
228+
```bash
229+
# Install required packages
230+
pip install -r requirements.txt
231+
# Or use auto-install
232+
python run_dashboard.py --install
233+
```
234+
235+
**Port already in use:**
236+
237+
```bash
238+
# Use different port
239+
python run_dashboard.py --port 8080
240+
```
241+
242+
**Permission denied:**
243+
244+
```bash
245+
# Make launcher executable (Linux/Mac)
246+
chmod +x run_dashboard.py
247+
```
248+
249+
### Debug Mode
250+
251+
Run with debug flag for detailed error information:
252+
253+
```bash
254+
python run_dashboard.py --debug
255+
```
256+
257+
## 📈 Performance
258+
259+
### Optimization Tips
260+
261+
- Dashboard is optimized for files up to 100MB
262+
- For large clusters (1000+ topics), consider:
263+
- Filtering internal topics in visualizations
264+
- Pagination for large tables
265+
- Caching for historical data
266+
267+
### Memory Usage
268+
269+
- Typical memory usage: 50-100MB
270+
- Scales with number of topics and historical reports
271+
- Auto-cleanup of old data stores
272+
273+
## 🔒 Security
274+
275+
### Network Access
276+
277+
- Default binding: `127.0.0.1` (localhost only)
278+
- For network access: use `--host 0.0.0.0`
279+
- Consider reverse proxy for production use
280+
281+
### Data Privacy
282+
283+
- All processing happens locally
284+
- No external API calls (except CDN for fonts)
285+
- Analysis data stays on your machine
286+
287+
## 🤝 Contributing
288+
289+
### Development Setup
290+
291+
```bash
292+
# Clone and setup
293+
git clone <repository>
294+
cd dashboard
295+
296+
# Install dev dependencies
297+
pip install -r requirements.txt
298+
299+
# Run in debug mode
300+
python run_dashboard.py --debug
301+
```
302+
303+
### Adding Features
304+
305+
1. Create new components in `components/`
306+
2. Add data processing in `utils/`
307+
3. Register callbacks in `app.py`
308+
4. Update layout as needed
309+
310+
## 📄 License
311+
312+
MIT License - see parent project for details.
313+
314+
## 🆘 Support
315+
316+
For issues and questions:
317+
318+
- Check troubleshooting section above
319+
- Review console output with `--debug` flag
320+
- Ensure analysis files are generated correctly
321+
- Verify Python version (3.8+ required)
15.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)