install via composer
vim composer.json
{
"minimum-stability": "dev",
"require": {
"jukylin/jaeger-php" : "^2.0",
"opentracing/opentracing":"1.0-beta1"
}
}
composer update
$config = Config::getInstance();
$tracer = $config->initTrace('example', '0.0.0.0:6831');
$config->gen128bit();
$spanContext = $tracer->extract(Formats\TEXT_MAP, $_SERVER);
$serverSpan = $tracer->startSpan('example HTTP', ['child_of' => $spanContext]);
$serverSpan->addBaggageItem("version", "2.0.0");
$clientTrace->inject($clientSapn1->spanContext, Formats\TEXT_MAP, $_SERVER);
//can search in Jaeger UI
$span->addTags(['http.status' => "200"]);
//log record
$span->log(['error' => "HTTP request timeout"]);
$config->setDisabled(true);
$span->finish();
$config->flush();
-
Transports
- via Thrift over UDP
-
Sampling
- ConstSampler
- ProbabilisticSampler