The three pillars of observability — Metrics, Logs, and Traces — give complete visibility into your app's health. Companies with mature observability resolve incidents 69% faster (Splunk, 2024).
Metrics with Prometheus
scrape_configs:
- job_name: "laravel"
scrape_interval: 15s
static_configs:
- targets: ["app:9090"]
- job_name: "mysql"
static_configs:
- targets: ["mysql-exporter:9104"]Key Metrics to Track
Application:
- Request rate (requests/second)
- Error rate (5xx responses / total)
- Response time (p50, p95, p99)
- Queue depth and processing time
Infrastructure:
- CPU and memory usage per container
- Disk I/O and space
- Network throughputStructured Logging in Laravel
// JSON format for log aggregation
'channels' => [
'structured' => [
'driver' => 'single',
'path' => storage_path('logs/app.json'),
'formatter' => Monolog\Formatter\JsonFormatter::class,
],
],
Log::channel('structured')->info('Order placed', [
'order_id' => $order->id,
'user_id' => $user->id,
'total' => $order->total,
'duration_ms' => $elapsed,
]);Grafana Dashboards
- RED Method — Rate, Errors, Duration for services
- USE Method — Utilization, Saturation, Errors for resources
Alerting Rules
groups:
- name: app_alerts
rules:
- alert: HighErrorRate
expr: rate(http_errors_total[5m]) / rate(http_requests_total[5m]) > 0.05
for: 5m
labels:
severity: critical
annotations:
summary: "Error rate above 5%"Observability turns "our site is down" into "we detected and fixed the issue before users noticed."