Telescope is invaluable for local development – it captures every individual request, query, and job so you can trace exactly what happened. But in production, that granularity becomes noise, and storing every query from thousands of daily requests isn’t practical. Laravel Pulse takes a different approach: it captures aggregate performance data, showing you patterns and trends rather than individual transactions.
Telescope tells you that one specific request took 2.3 seconds. Pulse tells you that the /api/reports endpoint has been your slowest route for the past 24 hours and is getting worse.
What Pulse Monitors
- Slow requests – routes averaging over your threshold
- Slow queries – SQL queries averaging over threshold, with source location
- Slow jobs – queued jobs taking longer than expected
- Exceptions – error rates by type (not individual stack traces)
- Cache hit rates – cache efficiency across the application
- Queue sizes – jobs pending per queue
- Active users – authenticated users active in the last period
- System resources – CPU, memory, storage (with server recorder)
Installation
composer require laravel/pulse
php artisan vendor:publish --provider="LaravelPulsePulseServiceProvider"
php artisan migrate
# Access the dashboard
# http://your-app.test/pulse
Configuration
// config/pulse.php
'retain' => [
DateInterval::createFromDateString('7 days'),
],
'sample_rate' => env('PULSE_SAMPLE_RATE', 1),
'slow_endpoint_threshold' => env('PULSE_SLOW_ENDPOINT_THRESHOLD', 1000), // ms
'slow_query_threshold' => env('PULSE_SLOW_QUERY_THRESHOLD', 1000),
'slow_job_threshold' => env('PULSE_SLOW_JOB_THRESHOLD', 1000),
'ignore' => [
'#^/pulse$#',
'#^/telescope#',
'#^/horizon#',
],
Recorders Configuration
'recorders' => [
RecordersCacheInteractions::class => [
'enabled' => env('PULSE_CACHE_RECORDER', true),
'sample_rate' => 0.1, // Sample 10% for busy caches
],
RecordersExceptions::class => [
'enabled' => env('PULSE_EXCEPTIONS_RECORDER', true),
'ignore' => [
'#^SymfonyComponentHttpKernelExceptionNotFoundHttpException#',
],
],
RecordersSlowQueries::class => [
'enabled' => env('PULSE_SLOW_QUERIES_RECORDER', true),
'threshold' => env('PULSE_SLOW_QUERY_THRESHOLD', 1000),
'highlight_threshold' => 2000,
],
RecordersServers::class => [
'enabled' => env('PULSE_SERVER_RECORDER', false), // Disabled by default
'directories' => ['/'],
],
],
Production: Async Ingestion
By default, Pulse writes performance data synchronously during requests. For production, use async processing:
// Schedule in routes/console.php
Schedule::command('pulse:ingest')->everyMinute();
// Or run continuously as a worker
php artisan pulse:work
Separate Database for High Traffic
// config/pulse.php
'storage' => [
'driver' => 'database',
'connection' => 'pulse', // Separate connection in config/database.php
],
Writing Custom Recorders
use LaravelPulseFacadesPulse;
// Record custom metrics
Pulse::record('stripe_latency', $latency_ms);
// In middleware
class RecordApiLatency
{
public function handle($request, $next)
{
$start = microtime(true);
$response = $next($request);
$latency = (microtime(true) - $start) * 1000;
Pulse::record('api_latency', 'external_api', $latency);
return $response;
}
}
Pulse vs Telescope: When to Use Each
- Telescope: local development – detailed debugging of individual requests and queries
- Pulse: staging and production – aggregate performance monitoring and trend analysis
- They complement each other: Pulse shows you which routes are slow; Telescope explains why one specific request was slow
Conclusion
Pulse fills a gap that previously required paid APM services like New Relic or Datadog for basic functionality – understanding which parts of your application are slow in aggregate. For most Laravel applications, Pulse in production and Telescope in development gives you everything you need to keep performance under control without external dependencies.

Leave a Reply
You must be logged in to post a comment.