- 필수 기능
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- 디지털 경험
- 소프트웨어 제공
- 보안
- 로그 관리
- 관리
- 인프라스트럭처
- ci
- containers
- csm
- ndm
- otel_guides
- overview
- slos
- synthetics
- tests
- 워크플로
The PHP tracer supports OpenTracing through the opentracing/opentracing library which is installed with Composer:
composer require opentracing/opentracing:1.0.0-beta5
When automatic instrumentation is enabled, an OpenTracing-compatible tracer is made available as the global tracer:
<?php
// Set the global tracer once, right after the composer autoload.php import.
$otTracer = new \DDTrace\OpenTracer\Tracer(\DDTrace\GlobalTracer::get());
\OpenTracing\GlobalTracer::set($otTracer);
// Anywhere a span is required
$scope = $otTracer->startActiveSpan('web.request');
$span = $scope->getSpan();
$span->setTag('service.name', 'service_name');
$span->setTag('resource.name', 'resource_name');
$span->setTag('span.type', 'web');
$span->setTag('http.method', $_SERVER['REQUEST_METHOD']);
// ...Use OpenTracing as expected
$scope->close();
?>
OpenTracing\GlobalTracer::get()
without the need to set the global tracer manually.