Search by

spiral / otel-bridge

wolfy-j

OpenTelemetry bridge for Spiral Framework

Package info

github.com/spiral/otel-bridge

pkg:composer/spiral/otel-bridge

Fund package maintenance!

spiral

Statistics

Installs: 22 920

Dependents: 0

Suggesters: 0

Stars: 5

Open Issues: 4

1.3.0 2026-10-16 14:21 UTC

This package is auto-updated.

Last update: 2026-10-20 15:45:19 UTC


README

Spiral Framework

OpenTelemetry tracing for Spiral Framework

Documentation Sponsor

Psalm Level Type Coverage Codecov Mutation testing badge


This package plugs the OpenTelemetry PHP SDK into the Spiral telemetry component as the otel tracer driver, so the spans of your application are exported to any OpenTelemetry-compatible backend and the trace context is propagated between services with W3C traceparent headers.

Get Started

Installation

composer require spiral/otel-bridge

PHP Latest Version on Packagist License Total Downloads

Install an exporter as well, for example OTLP:

composer require open-telemetry/exporter-otlp

Then add the bootloader to your application kernel:

public function defineBootloaders(): array
{
    return [
        // ...
        \Spiral\OpenTelemetry\Bootloader\OpenTelemetryBootloader::class,
        // ...
    ];
}

Configuration

Select the otel driver and configure the SDK with the standard OTEL_* environment variables:

# Telemetry driver [log, null, otel]
TELEMETRY_DRIVER=otel

OTEL_SERVICE_NAME=php # Your application name
OTEL_TRACES_EXPORTER=otlp
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318
OTEL_PHP_TRACES_PROCESSOR=simple

The exporter is created lazily, on the first export. The full list of variables is in the OpenTelemetry SDK configuration.

With OTEL_PHP_TRACES_PROCESSOR=batch (the SDK default) spans are queued and flushed after every request or job, and on application shutdown, through the Spiral finalizer. Spans still queued are lost when the worker is killed hard, e.g. by SIGKILL or the RoadRunner stop timeout.