https://github.com/taoso/jaeger-php
jaeger php client for OpenTracing API
https://github.com/taoso/jaeger-php
distributed-tracing jaeger jaeger-php microservice opentracing
Last synced: 11 months ago
JSON representation
jaeger php client for OpenTracing API
- Host: GitHub
- URL: https://github.com/taoso/jaeger-php
- Owner: taoso
- License: mit
- Created: 2017-11-02T13:26:43.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-09T08:53:23.000Z (almost 8 years ago)
- Last Synced: 2025-04-15T02:49:22.970Z (11 months ago)
- Topics: distributed-tracing, jaeger, jaeger-php, microservice, opentracing
- Language: PHP
- Homepage:
- Size: 42 KB
- Stars: 12
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jaeger-php
[](https://travis-ci.org/lvht/jaeger-php)
[](https://coveralls.io/github/lvht/jaeger-php?branch=master)
Jaeger UDP client for PHP OpenTracing API.
Forked from [jukylin/jaeger-php](https://github.com/jukylin/jaeger-php).
## Why fork?
Jukylin's work is awesome. But it doese not work with the latest [opentracing/opentracing-php](https://github.com/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
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
## Reference
[OpenTracing](http://opentracing.io/)
[Jaeger](https://uber.github.io/jaeger/)