PHP OpenTelemetry traces locally
Set OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:8000 and OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf for your PHP app, with the OpenTelemetry PHP SDK and the OTLP exporter installed. Your traces then show up in Buggregator as a waterfall of spans, with the service name on each span. You need no Jaeger, no Collector and no cloud account.
Steps
1. Start Buggregator
Run the container. Port 8000 is the web UI and also takes OTLP over HTTP.
docker run --pull always \
-p 127.0.0.1:8000:8000 \
-p 127.0.0.1:1025:1025 \
-p 127.0.0.1:9912:9912 \
-p 127.0.0.1:9913:9913 \
ghcr.io/buggregator/server:latest2. Install the extension and the SDK
Zero-code instrumentation needs the opentelemetry PHP extension. Build it and enable it in php.ini:
pecl install opentelemetry[opentelemetry]
extension=opentelemetry.soThen add the SDK, the OTLP exporter, an HTTP client for it, and the instrumentation package for your framework. This example uses Laravel's, open-telemetry/opentelemetry-auto-laravel; the OpenTelemetry registry lists packages for others.
composer require \
open-telemetry/sdk \
open-telemetry/exporter-otlp \
php-http/guzzle7-adapter \
open-telemetry/opentelemetry-auto-laravel3. Set the standard OTel variables
Set them in the environment PHP runs in. Buggregator accepts OTLP over HTTP, as protobuf or JSON. It takes traces and logs, not metrics, so turn the metrics exporter off.
OTEL_PHP_AUTOLOAD_ENABLED=true
OTEL_SERVICE_NAME=checkout
OTEL_TRACES_EXPORTER=otlp
OTEL_METRICS_EXPORTER=none
OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:8000
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobufGive the base URL only: the SDK adds /v1/traces itself. In Docker Compose, replace 127.0.0.1 with the Buggregator service name, for example buggregator.
4. Open the Traces tab
Load a few pages, then open the Sentry page and pick Traces. Each trace carries an OTel label and the services it went through. Open one to see its spans as a waterfall, with a Service column that shows checkout.
Why it works
OTLP is the protocol OpenTelemetry uses to send data. Buggregator takes it on its main port at the standard paths /v1/traces and /v1/logs, so the SDK sends to it like to any OTLP backend. The traces land on the Sentry page next to errors from Sentry SDKs. OTEL_SERVICE_NAME becomes the service in the UI.
Docs: docs.buggregator.dev/config/opentelemetry.html#otel-sdk
Requires Buggregator v2.12.0+
Related tips
- Sentry
See a Laravel request's Sentry trace as a waterfall
Turn on Sentry tracing in Laravel and send it to Buggregator. Every span of a request shows on a timeline, and errors link to their trace.
- OpenTelemetry
Laravel OpenTelemetry traces on your machine
Add OpenTelemetry auto-instrumentation to Laravel and send OTLP to Buggregator on port 8000. Each request shows as a span waterfall, no Jaeger needed.
- OpenTelemetry
Add Buggregator to your OTel Collector as one more exporter
Add an otlphttp exporter to your Collector config. Traces and logs from every service show up in Buggregator, and the apps stay as they are.
- OpenTelemetry
Node.js OpenTelemetry traces with no code changes
Run your Node service with OpenTelemetry auto-instrumentation and point OTLP at Buggregator. Each request shows as a waterfall of spans locally.
Checked on with Buggregator v2.13.0