Skip to content
← All packages

Telemetry for Laravel

alpha

Collector-free telemetry for Laravel. Prometheus metrics, OTLP traces, events and logs. No C extension, no protobuf, no sidecar. Metrics that work under FPM.

Telemetry for Laravel gives you Prometheus metrics, OTLP traces, events and trace-correlated logs from a single facade. No collector, no C extension, no protobuf. Metrics aggregate in Redis or APCu, so web workers, queue workers and nodes all write to the same series. Prometheus scrapes a route, and traces go straight to any OTLP backend as plain HTTP JSON.

Every Signal, One Package

Prometheus Endpoint

Scrape endpoints with IP allowlisting and per-endpoint metric filters. Expose a narrow public endpoint and a full internal one from the same app.

OTLP Without the SDK

Exports traces, metrics and logs as spec-stable OTLP HTTP JSON to Tempo, Grafana Cloud, Honeycomb or any other OTLP backend.

Auto-Instrumentation

Requests, queue jobs, DB queries, transactions, scheduled tasks, mail, notifications and outgoing HTTP calls. Full W3C trace propagation from dispatch site into queue workers.

Trace-Correlated Logs

A telemetry log channel turns Laravel logs into OTLP log records with severity mapping and trace ids, so a log line links to its trace waterfall.

Testing Fakes

Telemetry::fake() with assertions for counters, gauges, histograms, spans and events. Test your instrumentation like you test your mail.

Grafana Dashboards

Ships four dashboards via telemetry:dashboards: overview, requests, queue and schedule, and drill-down. Service-scoped and ready for the LGTM stack.

Why metrics fail under FPM

PHP is shared-nothing: in-process metric state dies with the request. That is why the official OpenTelemetry SDK's metrics need a collector sidecar to work under FPM. This package sidesteps the problem by aggregating metrics in shared storage instead. A counter incremented in a web request, a queue worker and an Artisan command ends up as one correct series, whatever node it ran on.

Resource attribution is built in: peak memory and CPU time per request, job and scheduled task, plus per-span CPU and memory deltas. Install System Metrics alongside it and host CPU, memory, load and real RSS metrics appear on the next scrape.

Zero cost when disabled

With TELEMETRY_ENABLED=false every instrument becomes a no-op, no listeners register and the routes disappear. And telemetry never throws into your app: a broken exporter degrades to nothing, not to a 500.