jukylin/jaeger-php

php client for jaeger

Installs: 1 467 325

Dependents: 8

Suggesters: 0

Security: 0

Stars: 225

Watchers: 11

Forks: 81

Open Issues: 23


README

Build Status Minimum PHP Version License Coverage Status

jaeger-php

Install

Install via composer.

composer config minimum-stability dev
composer require jukylin/jaeger-php

Init Jaeger-php

$config = Config::getInstance();
$tracer = $config->initTracer('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($clientSpan1->spanContext, Formats\TEXT_MAP, $_SERVER);

Tags and Log

// tags are searchable in Jaeger UI
$span->setTag('http.status', '200');

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

Close Tracer

$config->setDisabled(true);

Zipkin B3 Propagation

no support for Distributed context propagation

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

Finish span and flush Tracer

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

More example

Features

  • Transports

    • via Thrift over UDP
  • Sampling

    • ConstSampler
    • ProbabilisticSampler

Reference

OpenTracing

Jaeger