flow php

UNIFIED DATA PROCESSING FRAMEWORK

composer require flow-php/etl ~0.32.0

ChangelogRelease Cycle

play Try Playground

elephant
extract

Extracts

Read from various data sources.

arrow
transform

Transforms

Shape and optimize for your needs.

arrow
load

Loads

Store and secure in one of many available data sinks.


Definition


/**
 * Wrap a PostgreSQL client with telemetry instrumentation.
 *
 * Returns a decorator that adds spans, metrics, and logs to all
 * query and transaction operations following OpenTelemetry conventions.
 *
 * @param Client\Client $client The PostgreSQL client to instrument
 * @param PostgreSqlTelemetryConfig $telemetryConfig Telemetry configuration
 *
 * @example
 * $client = pgsql_client(pgsql_connection('host=localhost dbname=mydb'));
 *
 * $traceableClient = traceable_postgresql_client(
 *     $client,
 *     postgresql_telemetry_config(
 *         telemetry(resource(['service.name' => 'my-app'])),
 *         new SystemClock(),
 *         postgresql_telemetry_options(
 *             traceQueries: true,
 *             traceTransactions: true,
 *             collectMetrics: true,
 *             logQueries: true,
 *             maxQueryLength: 500,
 *         ),
 *     ),
 * );
 *
 * // All operations now traced
 * $traceableClient->transaction(function (Client $client) {
 *     $user = $client->fetchOne('SELECT * FROM users WHERE id = $1', [123]);
 *     $client->execute('UPDATE users SET last_login = NOW() WHERE id = $1', [123]);
 * });
 */
traceable_postgresql_client(Client $client, PostgreSqlTelemetryConfig $telemetryConfig) : TraceableClient

Contributors

Join us on GitHub external resource
scroll back to top