ellis / jaeger-client
Jaeger bindings for PHP OpenTracing API
Installs: 1 386
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: ^7.1
- apache/thrift: ^0.11.0
- opentracing/opentracing: ^1.0.0-beta5
- psr/log: ^1.1
Requires (Dev)
- phpunit/phpunit: ^7.4
- psr/http-message: ^1.0
This package is auto-updated.
Last update: 2024-10-29 03:58:52 UTC
README
Instrumentation library that implements an OpenTracing Tracer for Jaeger (https://jaegertracing.io).
Installation
composer require ellis/jaeger-client
Initialization
use Ellis\Jaeger\Reporter\RemoteReporter; use Ellis\Jaeger\Sampler\ConstSampler; use Ellis\Jaeger\Tracer; use Ellis\Jaeger\Transport\UdpTransport; use OpenTracing\GlobalTracer; $transport = new UdpTransport('127.0.0.1', 6831); $reporter = new RemoteReporter($transport); $sampler = new ConstSampler(true); $tracer = new Tracer('my-service', $reporter, $sampler); // Other libraries may try to get open tracing implementation from GlobalTracer // so setting your tracer instance to GlobalTracer is a good practice. GlobalTracer::set($tracer); // Make sure we gracefully close Tracer on any situation register_shutdown_function(function (Tracer $tracer, LoggerInterface $logger) { try { @$tracer->close(); } catch (\Exception $e) { $logger->warn('Failed closing Tracer: '.$e->getMessage()); } }, $tracer, $logger);