PHP Open Standards
Incident Management is now generally available! Incident Management is now generally available!

PHP Open Standards

OpenTracing

The PHP tracer supports OpenTracing via 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
$otTracer = new \DDTrace\OpenTracer\Tracer(\DDTrace\GlobalTracer::get());
\OpenTracing\GlobalTracer::set($otTracer);
$span = $otTracer->startActiveSpan('web.request')->getSpan();
$span->setTag('span.type', 'web');
$span->setTag('http.method', $_SERVER['REQUEST_METHOD']);
// ...Use OpenTracing as expected
?>
Before ddtrace version 0.46.0, an OpenTracing compatible tracer was automatically returned from OpenTracing\GlobalTracer::get() without the need to set the global tracer manually.

Further Reading

Additional helpful documentation, links, and articles: