cboxdk/laravel-telemetry
| Install | |
|---|---|
composer require cboxdk/laravel-telemetry |
|
| Latest Version: | v3.1.0 |
| PHP: | ^8.3|^8.4|^8.5 |
| License: | MIT |
| Last Updated: | Oct 1, 2026 |
| Links: | GitHub · Packagist |
Telemetry for Laravel
Collector-free telemetry for Laravel: Prometheus metrics, OTLP traces and events. No C extension, no protobuf, no sidecar — metrics that actually work under FPM.
Telemetry::counter('orders.created')->inc();
Telemetry::gauge('queue.depth', fn () => Queue::size());
Telemetry::histogram('checkout.duration', unit: 's')->record($seconds);
Telemetry::span('import.customers', function () {
// traced work — exceptions recorded, duration measured
});
Telemetry::event('autoscale.decision', ['workers' => 7]);
Why
PHP is shared-nothing: in-process metric state dies with the request, which is why the official OTel SDK's metrics don't work under FPM without a collector. This package aggregates metrics in Redis (or APCu) instead — web workers, queue workers and nodes all write to the same series. Prometheus scrapes a route; traces and events go straight to any OTLP backend as spec-stable HTTP JSON.
- ✅ Pure Composer package — deploys anywhere Laravel runs
- ✅ Prometheus scrape endpoint(s), closed by default outside local/testing (IP allowlist or bearer token — same convention as Horizon/Telescope), with metric filters
- ✅ Real OTLP (
/v1/traces,/v1/metrics,/v1/logs) without the SDK - ✅
telemetrylog channel: Laravel logs become trace-correlated OTLP log records (severity-mapped, feedback-loop safe) - ✅ Auto-instrumentation: requests, queue jobs (full W3C trace propagation
into workers), DB queries, commands — plus
Http::withTraceparent()for outbound calls - ✅ Auto-detects Horizon, Reverb and Pennant when installed — supervisor state/long-wait detection, WebSocket message/channel metrics, and feature-flag check counters, no extra config
- ✅
Telemetry::fake()with assertions for counters, gauges, histograms, spans and events - ✅ Provider contract so packages publish telemetry without coupling
- ✅ Host CPU/memory/load via
cboxdk/system-metrics— just install it - ✅ Zero cost when disabled; telemetry never throws into your app
- ✅ Resource attribution: peak memory + CPU per request/job/task, per-span
CPU & memory deltas, real RSS via
cboxdk/system-metrics - ✅ Ships 13 Grafana dashboards (
telemetry:dashboards) — an APM-style suite (requests, jobs, queries, cache, exceptions, system, users …) — service-scoped, LGTM-ready - ✅ Opt-in web analytics: a shared cookieless
session.id, unsampledpage_viewevents, and built-in geo + User-Agent enrichment (default off) - ✅ Browser/RUM tracing: a zero-build
@telemetryBrowsersnippet ingests frontend spans andtrack()events into the same trace as the backend, plus token-gated source-map upload for symbolicated JS stack traces - ✅ Error tracking flow: the trace id ties Sentry/Flare issues, support cases and the trace waterfall together automatically
- ✅ Optional native depth via
cboxdk/telemetry-native— CPU profiles with a confidence figure, exactpdo.connect/curl.exectiming, and a crash record correlated to the trace the process died in - ✅ AI-ready: ships Laravel Boost
guidelines,
llms.txtand an agent guide — your AI assistant follows the conventions out of the box
Installation
composer require cboxdk/laravel-telemetry
TELEMETRY_STORE=redis # redis | apcu | array
TELEMETRY_EXPORTERS=otlp # optional; Prometheus endpoint is on by default
TELEMETRY_OTLP_ENDPOINT=https://otlp.example.com:4318
Scrape GET /telemetry/metrics, and for OTLP metrics schedule the flush:
Schedule::command('telemetry:flush')->everyMinute()->onOneServer();
Documentation
Full documentation lives in docs/:
- Getting started — quickstart, testing, API reference, AI assistants
- Core concepts — metrics, traces, events, logs, naming
- Cookbook — multi-tenant SaaS, queue monitoring, external services
- Configuration reference
- Extension points — custom exporters
- Production — OTLP, the recommended Grafana stack, performance, security, analytics, browser/RUM tracing, error tracking
Publishing telemetry from your package
if (class_exists(\Cbox\Telemetry\Facades\Telemetry::class)) {
Telemetry::provider(new QueueMetricsProvider);
}
Telemetry never knows about your package — your package publishes telemetry if telemetry exists. See providers.
Development
composer check # pint --test, phpstan (level 8), pest
License
MIT. See LICENSE.md.
Related Packages
Observability toolkit for Laravel applications - Monitor HTTP requests, outbound...
Send app metrics from Laravel to Prometheus, StatsD, OpenTelemetry, CloudWatch a...
Production-ready Laravel Prometheus metrics package with built-in collectors for...
Laravel-native observability UI for cboxdk/laravel-telemetry: a versioned JSON A...
Laravel Prometheus monitoring package for multi-project server orchestration. Co...
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v3.1.0 | ^8.3| | ^12.0| | MIT | |
| v3.0.0 | ^8.3| | ^12.0| | MIT | |
| v2.7.2 | ^8.3| | ^12.0| | MIT | |
| v2.7.1 | ^8.3| | ^12.0| | MIT | |
| v2.7.0 | ^8.3| | ^12.0| | MIT | |
| v2.6.1 | ^8.3| | ^12.0| | MIT | |
| v2.6.0 | ^8.3| | ^12.0| | MIT | |
| v2.5.0 | ^8.3| | ^12.0| | MIT | |
| v2.4.0 | ^8.3| | ^12.0| | MIT | |
| v2.3.0 | ^8.3| | ^12.0| | MIT | |
| v2.2.1 | ^8.3| | ^12.0| | MIT | |
| v2.2.0 | ^8.3| | ^12.0| | MIT | |
| v2.1.0 | ^8.3| | ^12.0| | MIT | |
| v2.0.0 | ^8.3| | ^12.0| | MIT | |
| v1.5.1 | ^8.3| | ^12.0| | MIT | |
| v1.5.0 | ^8.3| | ^12.0| | MIT | |
| v1.4.1 | ^8.3| | ^12.0| | MIT | |
| v1.4.0 | ^8.3| | ^12.0| | MIT | |
| v1.3.1 | ^8.3| | ^12.0| | MIT | |
| v1.3.0 | ^8.3| | ^12.0| | MIT | |
| v1.2.0 | ^8.3| | ^12.0| | MIT | |
| v1.1.0 | ^8.3| | ^12.0| | MIT | |
| v1.0.0 | ^8.3| | ^12.0| | MIT | |
| v0.4.1 | ^8.3| | ^12.0| | MIT | |
| v0.4.0 | ^8.3| | ^12.0| | MIT | |
| v0.3.3 | ^8.3| | ^12.0| | MIT | |
| v0.3.2 | ^8.3| | ^12.0| | MIT | |
| v0.3.1 | ^8.3| | ^12.0| | MIT | |
| v0.3.0 | ^8.3| | ^12.0| | MIT | |
| v0.2.1 | ^8.3| | ^12.0| | MIT |
Showing the latest 30 of 31. See every release on Packagist
Pre-releases (17)
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v0.1.0-alpha.17 | ^8.3| | ^12.0| | MIT | |
| v0.1.0-alpha.16 | ^8.3| | ^12.0| | MIT | |
| v0.1.0-alpha.15 | ^8.3| | ^12.0| | MIT | |
| v0.1.0-alpha.14 | ^8.3| | ^12.0| | MIT | |
| v0.1.0-alpha.13 | ^8.3| | ^12.0| | MIT | |
| v0.1.0-alpha.12 | ^8.3| | ^12.0| | MIT | |
| v0.1.0-alpha.11 | ^8.3| | ^12.0| | MIT | |
| v0.1.0-alpha.10 | ^8.3| | ^12.0| | MIT | |
| v0.1.0-alpha.9 | ^8.3| | ^12.0| | MIT | |
| v0.1.0-alpha.8 | ^8.3| | ^12.0| | MIT | |
| v0.1.0-alpha.7 | ^8.3| | ^12.0| | MIT | |
| v0.1.0-alpha.6 | ^8.3| | ^12.0| | MIT | |
| v0.1.0-alpha.5 | ^8.3| | ^12.0| | MIT | |
| v0.1.0-alpha.4 | ^8.3| | ^12.0| | MIT | |
| v0.1.0-alpha.3 | ^8.3| | ^12.0| | MIT | |
| v0.1.0-alpha.2 | ^8.3| | ^12.0| | MIT | |
| v0.1.0-alpha.1 | ^8.3| | ^12.0| | MIT |