Skip to content

Commit a6215dd

Browse files
committed
docs: added -monitor CLI option documentation and completed features
1 parent a672da2 commit a6215dd

2 files changed

Lines changed: 19 additions & 375 deletions

File tree

README.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ A powerful multi-dialect SQL query analysis tool written in Go that provides com
1212
- **⚡ Sub-Microsecond Parsing**: Parse queries in <1μs (SQL Server: 375ns!)
1313
- **🔍 Schema-Aware Validation**: Validate SQL against database schemas
1414
- **📊 Execution Plan Analysis**: Analyze EXPLAIN output and detect bottlenecks
15+
- **📈 Real-Time Log Monitoring**: Watch and analyze SQL logs as they're written
1516
- **💡 Smart Optimizations**: Dialect-specific optimization suggestions
1617
- **🚀 Production-Ready Performance**: Zero-allocation paths, object pooling, intelligent caching
1718

@@ -81,6 +82,16 @@ make test
8182
./bin/sqlparser -sql "SELECT [user_id] FROM [users]" -dialect sqlserver
8283
```
8384

85+
### Real-Time Log Monitoring
86+
87+
```bash
88+
# Watch SQL log file and analyze queries in real-time
89+
./bin/sqlparser -monitor /var/log/mysql/slow-query.log -dialect mysql
90+
91+
# With alert rules for slow queries
92+
./bin/sqlparser -monitor /var/log/postgresql/postgresql.log -dialect postgresql -verbose
93+
```
94+
8495
See [docs/EXAMPLES.md](docs/EXAMPLES.md) for comprehensive usage examples.
8596

8697
## 📚 Supported SQL Features
@@ -132,6 +143,7 @@ Options:
132143
-query FILE Analyze SQL query from file
133144
-sql STRING Analyze SQL query from string
134145
-log FILE Parse SQL Server log file
146+
-monitor FILE Monitor SQL log file in real-time (watches for new entries)
135147
-output FORMAT Output format: json, table (default: json)
136148
-dialect DIALECT SQL dialect: mysql, postgresql, sqlserver, sqlite, oracle (default: sqlserver)
137149
-verbose Enable verbose output
@@ -186,7 +198,8 @@ sql-parser-go/
186198
│ ├── dialect/ # Dialect-specific support
187199
│ ├── schema/ # Schema definitions and validation
188200
│ ├── plan/ # Execution plan analysis
189-
│ └── logger/ # Log parsing
201+
│ ├── logger/ # Log parsing
202+
│ └── monitor/ # Real-time log monitoring
190203
├── internal/
191204
│ ├── config/ # Configuration management
192205
│ └── performance/ # Performance monitoring
@@ -202,6 +215,7 @@ sql-parser-go/
202215
4. **Dialect** - Handles dialect-specific syntax and features
203216
5. **Schema** - Schema loading and validation (7.2μs load, 155-264ns validation)
204217
6. **Plan** - Execution plan analysis (46ns analysis, 117ns bottleneck detection)
218+
7. **Monitor** - Real-time log watching and processing with alert rules
205219

206220
## 🚀 Performance Highlights
207221

@@ -289,13 +303,15 @@ make dev-log
289303
- [x] View definitions (CREATE VIEW, CREATE MATERIALIZED VIEW)
290304
- [x] Trigger parsing (CREATE TRIGGER, DROP TRIGGER)
291305
- [x] **Control flow statements** (IF, WHILE, FOR, LOOP, REPEAT, EXIT, CONTINUE)
306+
- [x] **Real-time log monitoring** (LogWatcher, LogProcessor, AlertManager)
292307
- [x] Performance benchmarking
293308
- [x] Dialect-specific optimizations
294309

295310
### 🚧 Planned Features
296311

297-
- [ ] Real-time log monitoring
298-
- [ ] Integration with monitoring tools
312+
- [ ] Query rewriting (automatic SQL optimization)
313+
- [ ] Batch analysis (analyze multiple files at once)
314+
- [ ] Integration with monitoring tools (Prometheus, webhooks)
299315

300316
## 🤝 Contributing
301317

0 commit comments

Comments
 (0)