Skip to content

Commit

Permalink
Fix examples/traces/demo (#755)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nevay authored Jul 8, 2022
1 parent 19e09f5 commit 8e30ea0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/traces/demo/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ x-otel-common:
OTEL_TRACES_SAMPLER: parentbased_always_on
OTEL_TRACES_EXPORTER: otlp
OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: grpc
OTEL_EXPORTER_OTLP_ENDPOINT: localhost:4317
OTEL_EXPORTER_OTLP_ENDPOINT: collector:4317
OTEL_PHP_TRACES_PROCESSOR: simple

version: '3.7'
Expand Down
5 changes: 2 additions & 3 deletions examples/traces/demo/src/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@
use OpenTelemetry\API\Trace\StatusCode;
use OpenTelemetry\Context\Context;
use OpenTelemetry\SDK\Trace\Tracer;
use OpenTelemetry\SDK\Trace\TracerProvider;
use OpenTelemetry\SDK\Trace\TracerProviderFactory;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Server\RequestHandlerInterface as RequestHandler;
use Slim\Routing\RouteContext;

//create default tracer from environment variables, now available as TracerProvider::getDefaultTracer
$tracer = (new TracerProviderFactory('example'))->create()->getTracer('io.opentelemetry.contrib.php');
$tracerProvider = (new TracerProviderFactory('example'))->create();
$tracer = $tracerProvider->getTracer('io.opentelemetry.contrib.php');

$cb = new ContainerBuilder();
$container = $cb->addDefinitions([
Expand Down

0 comments on commit 8e30ea0

Please sign in to comment.