0.2.3 • Published 1 month ago
@stacksleuth/mysql-agent v0.2.3
@stacksleuth/mysql-agent
StackSleuth MySQL Agent
🚀 What is StackSleuth MySQL Agent?
Advanced MySQL performance monitoring agent - Query optimization, index analysis, connection pool monitoring, slow query detection, and real-time database performance insights.
✨ Key Features
- 🐬 Query Performance Monitoring: MySQL query optimization analysis
- 📊 Index Analysis: Index usage and optimization recommendations
- 🔗 Connection Pool Tracking: Database connection efficiency
- 🐌 Slow Query Detection: Automatic slow query identification
- 💾 Memory Usage Monitoring: MySQL memory usage optimization
- 🔄 Real-time Metrics: Live database performance insights
- ⚡ Multiple Driver Support: mysql2, mysql, and TypeORM support
- 📈 Table-level Statistics: Per-table performance analytics
📦 Installation
npm install @stacksleuth/mysql-agent
yarn add @stacksleuth/mysql-agent
pnpm add @stacksleuth/mysql-agent
🏁 Quick Start
import mysql from 'mysql2/promise';
import { MySQLAgent } from '@stacksleuth/mysql-agent';
// Initialize MySQL agent
const agent = new MySQLAgent({
enabled: true,
monitorQueries: true,
trackSlowQueries: true,
slowQueryThreshold: 1000 // ms
});
// Create MySQL connection
const connection = await mysql.createConnection({
host: 'localhost',
user: 'root',
password: 'password',
database: 'myapp'
});
// Instrument MySQL connection
agent.instrumentConnection(connection);
// Start monitoring
agent.startMonitoring();
// Your MySQL queries are now monitored
const [rows] = await connection.execute(
'SELECT * FROM users WHERE active = ?',
[true]
);
📚 Resources
🤝 Contributing
We welcome contributions! Please see our Contributing Guide for details.
📄 License
MIT License - see the LICENSE file for details.
Website • Documentation • NPM Registry • GitHub
Made with ⚡ by StackSleuth