@stacksleuth/laravel-agent
v0.2.4
Published
Comprehensive Laravel performance monitoring agent - Eloquent ORM optimization, route performance analysis, middleware tracking, job queue monitoring, and advanced cache performance metrics.
Maintainers
Readme
@stacksleuth/laravel-agent
StackSleuth Laravel Agent
🚀 What is StackSleuth Laravel Agent?
Comprehensive Laravel performance monitoring agent - Eloquent ORM optimization, route performance analysis, middleware tracking, job queue monitoring, and advanced cache performance metrics.
✨ Key Features
- 🎼 Eloquent ORM Monitoring: Query optimization and N+1 detection
- 🛣️ Route Performance: Laravel route execution analysis
- 🔧 Middleware Tracking: Request middleware performance monitoring
- ⚙️ Job Queue Monitoring: Background job performance tracking
- 🗄️ Cache Performance: Laravel cache system optimization
- 📧 Mail Tracking: Email sending performance analysis
- 🔄 Event Monitoring: Laravel event system performance
- ⚡ Artisan Integration: Command-line monitoring capabilities
📦 Installation
# npm
npm install @stacksleuth/laravel-agent
# yarn
yarn add @stacksleuth/laravel-agent
# pnpm
pnpm add @stacksleuth/laravel-agentyarn add @stacksleuth/laravel-agentpnpm add @stacksleuth/laravel-agent🏁 Quick Start
<?php
// config/app.php
'providers' => [
// ... other providers
StackSleuth\Laravel\StackSleuthServiceProvider::class,
],
// config/stacksleuth.php
return [
'enabled' => env('STACKSLEUTH_ENABLED', true),
'sample_rate' => env('STACKSLEUTH_SAMPLE_RATE', 0.1),
'monitor_eloquent' => true,
'monitor_cache' => true,
'monitor_jobs' => true,
];
// In your controller
use StackSleuth\Laravel\Facades\StackSleuth;
class UserController extends Controller
{
public function index()
{
StackSleuth::startSpan('fetch-users');
$users = User::with('profile')->paginate(10);
StackSleuth::endSpan();
return response()->json($users);
}
}🛠️ Troubleshooting
Common Issues
Agent Not Starting
// Enable debug mode
const agent = new LaravelAgent({
enabled: true,
debug: true
});High Memory Usage
// Optimize memory usage
const agent = new LaravelAgent({
bufferSize: 500,
flushInterval: 5000,
sampleRate: 0.01
});Missing Metrics
- Check that the agent is enabled
- Verify your API key and project ID
- Ensure sampling rate allows data through
- Check network connectivity to StackSleuth API
Debug Mode
DEBUG=stacksleuth:* node your-app.js📚 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
