Skip to content

Laravel Metrics

OpenTelemetry metrics for Laravel that work under PHP-FPM. Install the package, and HTTP requests, queries, queue jobs, cache operations, scheduled tasks and exceptions are recorded with no code.
Terminal window
composer require nwidart/laravel-metrics

Zero-code instrumentation

http.server.request.duration, db.client.operation.duration, messaging.process.duration, transactions, queries per request, Eloquent models, cache operations, scheduled tasks and reported exceptions, with the names of the OpenTelemetry semantic conventions.

Built for PHP-FPM

Each request records in memory, then merges into Redis after the response is sent. Every worker and every host adds up in one store.

Prometheus or OTLP

Serve GET /metrics in the Prometheus text format, or push to an OpenTelemetry Collector or any OTLP backend with php artisan metrics:push.

Safe by default

A Redis failure never fails a request. Cardinality is bounded, and the scrape route is off until you turn it on.