Skip to content
Search

Flow Telemetry and the OpenTelemetry PHP SDK

Flow Telemetry is an independent implementation of OpenTelemetry for PHP. It is not a wrapper around the official SDK, and it does not use any of its packages. Both send the same OTLP data, so the same collectors and backends accept it.

Back

No singletons, no implicit behavior

  • There is no global instance. You create a Telemetry object and pass it to the code that needs it.
  • Composer loads the library and nothing runs. No span, no export and no configuration starts by itself.
  • Nothing is read from the environment to build the pipeline. What the code says is what runs.
  • Nothing is instrumented until you wrap it. A bridge takes your HTTP client, logger or kernel and returns one of the same type that records telemetry.
<?php

use function Flow\Bridge\Psr18\Telemetry\DSL\psr18_traceable_client;

$client = psr18_traceable_client($client, $telemetry);

What is different

Point OpenTelemetry PHP SDK Flow Telemetry
Instrumentation Hooks from the opentelemetry C extension Bridges that wrap a client, a handler or a kernel
Extension The PDO, Symfony and Guzzle instrumentation packages require it None
Entry point A static Globals registry with lazy initializers A Telemetry object that you create and pass to your code
Current context Static storage in the Context class A ContextStorage object that you give to the providers
Code at autoload Composer loads six files on each request, and one calls the SDK autoloader Composer loads one file, and it only defines functions
Configuration Can build itself from OTEL_* environment variables Built in PHP code
Composer packages open-telemetry/sdk requires 13 packages, with a PSR-18 client and PSR-17 factories psr/clock and symfony/polyfill-mbstring
HTTP export A PSR-18 client found with php-http/discovery A curl transport in the OTLP bridge
Protobuf The OTLP exporter always installs google/protobuf Optional. OTLP over HTTP with JSON needs no package
PHP version 8.2 or newer 8.3 or newer

The SDK column describes open-telemetry/sdk 1.18.0 and the open-telemetry/opentelemetry-php-contrib instrumentation packages, as read in their source on 2026-12-01.

What is the same

  • The protocol: OTLP for traces, metrics and logs, over HTTP or gRPC.
  • The specification: samplers, processors, limits, resources and W3C propagation follow it.
  • A new span does not become the current span.
  • A batching processor keeps 512 spans by default and sends them inside the request.

How to start

The setup is one expression. It needs no extension, no environment variable and no network. This example prints each span to the console:

<?php

use Flow\Telemetry\Provider\Clock\SystemClock;

use function Flow\Telemetry\DSL\{
    console_exporter,
    memory_context_storage,
    pass_through_span_processor,
    resource,
    telemetry,
    tracer_provider,
};

$telemetry = telemetry(
    resource(['service.name' => 'my-app']),
    tracer_provider(
        pass_through_span_processor(console_exporter()),
        new SystemClock(),
        memory_context_storage(),
    ),
);

$tracer = $telemetry->tracer('http-handler');
$span = $tracer->span('handle-request');
$tracer->complete($span);

To send the data to a collector, read the OTLP Bridge.

Found a typo or an outdated section? Edit this page on GitHub


Contributors

Built in the open.

Join us on GitHub
scroll back to top