Jaeger Bindings for PHP OpenTracing API
Branch: master
Clone or download
Latest commit df97620 Dec 3, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example Update README.md Sep 29, 2018
src/Jaeger fixing numbers Nov 18, 2018
tests rename Dec 11, 2017
.gitignore traceId转为十六进制传输 Aug 12, 2017
LICENSE Create LICENSE Aug 22, 2017
README.md support zipkin header Sep 18, 2018
composer.json opentracing/opentracing's tags Mar 19, 2018

README.md

jaeger-php

principle of Distributed Tracing

install

install via composer

vim composer.json

{
  "minimum-stability": "dev",
  "require":           {
    "jukylin/jaeger-php" : "^2.0",
    "opentracing/opentracing":"1.0.0-beta2"
  }
}

composer update

Init Jaeger-php

$config = Config::getInstance();
$tracer = $config->initTrace('example', '0.0.0.0:6831');

128bit

$config->gen128bit();

Extract from Superglobals

$spanContext = $tracer->extract(Formats\TEXT_MAP, $_SERVER);

Start Span

$serverSpan = $tracer->startSpan('example HTTP', ['child_of' => $spanContext]);

Distributed context propagation

$serverSpan->addBaggageItem("version", "2.0.0");

Inject into Superglobals

$clientTrace->inject($clientSapn1->spanContext, Formats\TEXT_MAP, $_SERVER);

Tags and Log

//can search in Jaeger UI
$span->addTags(['http.status' => "200"]);

//log record
$span->log(['error' => "HTTP request timeout"]);

Close Trace

$config->setDisabled(true);

Zipkin B3 Propagation

not support 128bit and Distributed context propagation

$config::$propagator = \Jaeger\Constants\PROPAGATOR_ZIPKIN;

finish span and flush Trace

$span->finish();
$config->flush();

more example

Features

  • Transports

    • via Thrift over UDP
  • Sampling

    • ConstSampler
    • ProbabilisticSampler

Reference

OpenTracing

Jaeger