From 7371e07fdac8f8eec5b361988f577adbafd6fd51 Mon Sep 17 00:00:00 2001 From: Weslen Teche Date: Mon, 1 Apr 2024 03:19:03 -0300 Subject: [PATCH] fix example (#248) --- examples/instrumentation/Psr18/request.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/instrumentation/Psr18/request.php b/examples/instrumentation/Psr18/request.php index 5929f2cc..9b537159 100644 --- a/examples/instrumentation/Psr18/request.php +++ b/examples/instrumentation/Psr18/request.php @@ -6,6 +6,7 @@ use GuzzleHttp\Psr7\Request; use OpenTelemetry\API\Instrumentation; use OpenTelemetry\API\Trace\Propagation\TraceContextPropagator; +use OpenTelemetry\SDK\Common\Export\Stream\StreamTransportFactory; use OpenTelemetry\SDK\Common\Time\ClockFactory; use OpenTelemetry\SDK\Resource\ResourceInfoFactory; use OpenTelemetry\SDK\Trace\Sampler\AlwaysOnSampler; @@ -15,8 +16,11 @@ require_once dirname(__DIR__, 3) . '/vendor/autoload.php'; +$transport = (new StreamTransportFactory())->create('php://output', 'application/json'); +$exporter = new ConsoleSpanExporter($transport); + $tracerProvider = new TracerProvider( - new BatchSpanProcessor(new ConsoleSpanExporter(), ClockFactory::getDefault()), + new BatchSpanProcessor($exporter, ClockFactory::getDefault()), new AlwaysOnSampler(), ResourceInfoFactory::emptyResource(), );