lvht / jaeger
php client for jaeger
Installs: 37 736
Dependents: 0
Suggesters: 0
Security: 0
Stars: 12
Watchers: 3
Forks: 5
Open Issues: 0
Requires
- php: ^7
- lvht/jaeger-idl: ^0.9.0
- opentracing/opentracing: ^1.0.0-beta2
Requires (Dev)
- guzzlehttp/guzzle: ^6.3
- mockery/mockery: ^1.0
- php-coveralls/php-coveralls: ^1.0
- phpunit/phpunit: ^6.5
This package is not auto-updated.
Last update: 2024-11-19 12:13:58 UTC
README
Jaeger UDP client for PHP OpenTracing API.
Forked from jukylin/jaeger-php.
Why fork?
Jukylin's work is awesome. But it doese not work with the latest opentracing/opentracing-php.
This repo fix its issue and make a huge refactor for simplicity and psr.
Feel free to choose this repo or Jukylin's.
Install
composer config minimum-stability dev
composer config prefer-stable 1
composer require lvht/jaeger
Usage
<?php use Jaeger\Factory; use OpenTracing\Formats; // init factory $factory = Factory::getInstance(); // make OpenTracing\Tracer instance $tracer = $factory->initTracer('user', '127.0.0.1', 6831); // extract parent infomation from http header $carrier = $_SERVER['HTTP_UBER_TRACE_ID']; // extract the infomation and generate a new context // only support binary carrier now $context = $tracer->extract(Formats\BINARY, $carrier); // make a new span $span = $tracer->startSpan('foo', ['child_of' => $context]); // do your job here // finish the span $span->finish(); // report infomation to jaeger $tracer->flush();
Example
Run jaeger in docker
docker run --rm -d -p 6831:6831/udp -p 16686:16686 jaegertracing/all-in-one:latest
Start demo http server
cd example
php -S 0.0.0.0:8080 HTTP.php
Run Hprose.php
cd example
php Hprose.php
So you can see the Jaeger UI in http://127.0.0.1:16686
Good luck :)
Features
-
Transports
- via Thrift over UDP
-
Sampling
- ConstSampler
- ProbabilisticSampler