artprima/prometheus-metrics-bundle
Symfony bundle integrating promphp/prometheus_client_php to expose Prometheus metrics for your app. Supports Symfony 5.4–8.x and PHP 8.2–8.5, with configurable metric namespace, ignored routes, and custom labels for HTTP/request metrics.
HttpKernel in a Laravel app). For pure Laravel, this requires a custom adapter layer to translate Symfony events (kernel.request, kernel.response) into Laravel’s middleware/container system.promphp/prometheus_client_php, a mature PHP Prometheus client, ensuring compatibility with existing Prometheus/Grafana stacks.EventDispatcher). Requires:
RequestEvent/ResponseEvent to Laravel’s middleware pipeline.ServiceProvider to register Symfony’s CollectorRegistry and bundle services.promphp/prometheus_client_php is PHP-agnostic, so integration is feasible but requires manual wiring of collectors to Laravel’s event system (e.g., Illuminate\Http\Kernel events).Redis via predis or php-redis).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Symfony Event System | High | Build a Laravel-Symfony event bridge (e.g., middleware to dispatch Symfony events). |
| Metrics Collector Gaps | Medium | Implement Laravel-specific collectors (e.g., for Illuminate\Queue jobs, Illuminate\Database queries). |
| Storage Backend Conflicts | Low | Use Redis (shared between Laravel and Prometheus) or APCu (if enabled). |
| Performance Overhead | Medium | Benchmark metric collection latency (e.g., Redis vs. in-memory). |
| Grafana Dashboard Gaps | Low | Adapt existing dashboards or build Laravel-specific ones (e.g., queue metrics). |
Event system to replicate Symfony’s kernel.* events?MetricsCollectorInterface to support Laravel’s ServiceContainer?symfony/http-kernel) or a custom event dispatcher to translate Laravel events to Symfony’s kernel.*.promphp/prometheus_client_php is Laravel-agnostic; integration depends on event wiring.predis/php-redis); ideal for shared metrics storage.Laravel\SymfonyBridge).symfony/http-kernel to wrap Laravel’s Application in a Symfony kernel.AppKernel.kernel.request → Laravel’s booted event).CollectorRegistry to Laravel’s container.Illuminate\Queue, Illuminate\Database).| Component | Laravel Compatibility | Notes |
|---|---|---|
| Symfony Event System | ❌ (Low) | Requires custom bridge or middleware. |
| Prometheus Client | ✅ (High) | PHP-agnostic; works with any event system. |
| Redis Storage | ✅ (High) | Laravel’s Redis cache can double as Prometheus storage. |
| APCu Storage | ⚠️ (Medium) | Requires APCu extension (not always enabled in Laravel). |
| Custom Metrics | ✅ (High) | Can extend MetricsCollectorInterface for Laravel-specific data. |
| Grafana Dashboards | ⚠️ (Medium) | May need adaptation for Laravel metrics (e.g., queue jobs). |
artprima/prometheus-metrics-bundle and promphp/prometheus_client_php to composer.json.kernel.* (or vice versa).kernel.request when Laravel’s Illuminate\Http\Request is processed.disable_default_metrics: false)./metrics/prometheus endpoint.services.yaml (via Laravel’s ServiceProvider).prometheus.yml).artprima/prometheus-metrics-bundle for Symfony version drops (e.g., Symfony 5.4 EOL).promphp/prometheus_client_php is stable, but Laravel’s event system may drift from Symfony’s.10k RPS to validate latency impact.How can I help you explore Laravel packages today?