Flow PHP

Telemetry

FinalYes

Main entry point to all telemetry operations.

Provides unified access to tracing, metrics, and logging through their respective providers. Coordinates lifecycle operations (flush, shutdown) across all providers.

Instances of Tracer, Meter, and Logger are cached by this class to ensure that calling tracer/meter/logger with the same parameters returns the same instance.

Methods

__construct()  : mixed
flush()  : bool
Flush all pending telemetry data.
logger()  : Logger
Get or create a logger for the given scope.
meter()  : Meter
Get or create a meter for the given scope.
registerShutdownFunction()  : $this
Register a shutdown function to automatically shutdown telemetry.
shutdown()  : bool
Shutdown all telemetry and release resources.
tracer()  : Tracer
Get or create a tracer for the given scope.

Methods

flush()

Flush all pending telemetry data.

public flush() : bool

Collects metrics from all cached meters, then flushes all processors. Returns true only if all flush operations succeed.

Return values
bool

logger()

Get or create a logger for the given scope.

public logger(string $name[, string $version = 'unknown' ][, null|string $schemaUrl = null ][, null|Attributes $attributes = null ]) : Logger

Loggers are cached by name, version, schemaUrl, and attributes. Calling this method with the same parameters returns the same Logger instance.

Parameters
$name : string

The name of the instrumentation scope

$version : string = 'unknown'

The version of the instrumentation scope

$schemaUrl : null|string = null

Schema URL for semantic conventions

$attributes : null|Attributes = null

Additional scope attributes

Return values
Logger

meter()

Get or create a meter for the given scope.

public meter(string $name[, string $version = 'unknown' ][, null|string $schemaUrl = null ][, null|Attributes $attributes = null ]) : Meter

Meters are cached by name, version, schemaUrl, and attributes. Calling this method with the same parameters returns the same Meter instance.

Parameters
$name : string

The name of the instrumentation scope

$version : string = 'unknown'

The version of the instrumentation scope

$schemaUrl : null|string = null

Schema URL for semantic conventions

$attributes : null|Attributes = null

Additional scope attributes

Return values
Meter

registerShutdownFunction()

Register a shutdown function to automatically shutdown telemetry.

public registerShutdownFunction() : $this

This ensures all pending spans, metrics, and logs are exported when the PHP script terminates. The shutdown function will call shutdown() which flushes and releases all provider resources.

Return values
$this

For method chaining

shutdown()

Shutdown all telemetry and release resources.

public shutdown() : bool

Flushes all pending data, then shuts down all transports. Transport shutdown is idempotent, allowing multiple exporters to share the same transport safely.

Return values
bool

tracer()

Get or create a tracer for the given scope.

public tracer(string $name[, string $version = 'unknown' ][, null|string $schemaUrl = null ][, null|Attributes $attributes = null ]) : Tracer

Tracers are cached by name, version, schemaUrl, and attributes. Calling this method with the same parameters returns the same Tracer instance.

Parameters
$name : string

The name of the instrumentation scope

$version : string = 'unknown'

The version of the instrumentation scope

$schemaUrl : null|string = null

Schema URL for semantic conventions

$attributes : null|Attributes = null

Additional scope attributes

Return values
Tracer

        
On this page

Search results