Track operations through your application with distributed tracing.
Spans represent individual operations and can be nested to show parent-child relationships,
making it easy to visualize request flow and identify bottlenecks.
UNIFIED DATA PROCESSING FRAMEWORK
composer require flow-php/etl ~0.32.0 Extracts
Read from various data sources.
Transforms
Shape and optimize for your needs.
Loads
Store and secure in one of many available data sinks.
Examples:
Description
Documentation
- Telemetry Library
- OTLP Bridge - Export telemetry data to OpenTelemetry Protocol backends
- PSR-18 Telemetry Bridge - HTTP client instrumentation for telemetry
- PSR-7 Telemetry Bridge - HTTP message telemetry formatting
- Monolog Telemetry Bridge - Integrate telemetry with Monolog logging
- Symfony HttpFoundation Telemetry - Telemetry events for Symfony HTTP requests
- Symfony Telemetry Bundle - Symfony bundle for telemetry integration
Code
<?php
declare(strict_types=1);
use Flow\Telemetry\Provider\Clock\SystemClock;
use Flow\Telemetry\Tracer\SpanKind;
use Flow\Telemetry\Tracer\SpanStatus;
use function Flow\Telemetry\DSL\{
console_span_exporter,
memory_context_storage,
memory_span_processor,
resource_detector,
telemetry,
tracer_provider
};
use function Flow\ETL\DSL\clock;
require __DIR__ . '/vendor/autoload.php';
$telemetry = telemetry(
resource_detector()->detect(),
tracer_provider(
memory_span_processor(console_span_exporter(colors: false)),
clock(),
memory_context_storage(),
),
)->registerShutdownFunction();
$tracer = $telemetry->tracer('order-service');
$span = $tracer->span('process-order', SpanKind::INTERNAL);
$span->setAttribute('order.id', 'ORD-12345');
$span->setAttribute('customer.id', 42);
$childSpan = $tracer->span('validate-payment', SpanKind::INTERNAL);
$childSpan->setAttribute('payment.method', 'credit_card');
$childSpan->setStatus(SpanStatus::ok());
$tracer->complete($childSpan);
$span->setStatus(SpanStatus::ok());
$tracer->complete($span);