Alerting Configuration Analyzer
| Analyzer ID | Category | Severity | Time To Fix |
|---|---|---|---|
alerting-config | ✅ Reliability | Medium | 15 minutes |
What This Checks
Validates that proper alerting mechanisms are in place to detect production issues. Checks for:
- Exception notification handler (
report/reportablecallbacks with actual alerting) - Log alerting channel (Slack, syslog, papertrail, Monolog custom, or alerting packages)
- Failed job notification (
Queue::failingcallback or jobfailed()methods)
Why It Matters
- Silent Failures: Without alerting, production errors go unnoticed until users complain
- Queue Health: Failed jobs without notifications silently drop critical tasks (emails, payments, etc.)
- Mean Time to Recovery: Alerting reduces MTTR from hours/days to minutes
How to Fix
Quick Fix (5 minutes)
Install a monitoring package — these auto-register exception handlers and satisfy the check without any extra configuration:
bash
composer require sentry/sentry-laravel
# or
composer require rollbar/rollbar-laravel
# or
composer require bugsnag/bugsnag-laravelAlternatively, add a Slack log channel for immediate alerts:
php
// config/logging.php
'channels' => [
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Bot',
'emoji' => ':boom:',
'level' => 'error',
],
'stack' => [
'driver' => 'stack',
'channels' => ['daily', 'slack'],
],
],Proper Fix (15 minutes)
1. Add exception alerting:
php
->withExceptions(function (Exceptions $exceptions) {
$exceptions->reportable(function (Throwable $e) {
if (app()->environment('production')) {
Notification::route('slack', config('services.slack.webhook'))
->notify(new ExceptionOccurred($e));
}
});
})php
public function register(): void
{
$this->reportable(function (Throwable $e) {
if (app()->environment('production')) {
Notification::route('slack', config('services.slack.webhook'))
->notify(new ExceptionOccurred($e));
}
});
}2. Add failed job notifications:
php
// app/Providers/AppServiceProvider.php
use Illuminate\Support\Facades\Queue;
use Illuminate\Queue\Events\JobFailed;
public function boot(): void
{
Queue::failing(function (JobFailed $event) {
Log::channel('slack')->error('Job failed', [
'job' => $event->job->resolveName(),
'exception' => $event->exception->getMessage(),
]);
});
}References
Related Analyzers
- Missing Error Tracking - Detects missing error tracking services
- Health Check - Validates health check endpoints
- Data Retention Policy - Validates data cleanup policies