micro-module / jaeger-php
php client for jaeger
v2.2.2
2024-02-09 17:08 UTC
Requires
- php: ^7.1 || ^8.0
- opentracing/opentracing: ^1.0
- packaged/thrift: ^0.13
Requires (Dev)
- dev-master
- v2.2.2
- v2.2.1
- v2.2.0
- v2.1.3
- v2.1.3-beta
- v2.1.2-beta
- v2.1.1-beta
- v2.1.0-beta
- v2.0.9-beta
- v2.0.8-beta
- v2.0.7-beta
- v2.0.6-beta
- v2.0.5-beta
- v2.0.4-beta
- v2.0.3-beta
- v2.0.2-beta
- v2.0.1-beta
- v2.0.0-beta
- v1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-fix-typehints
- dev-lock-opentracing-version
- dev-dev_v3
- dev-stable
- dev-hotfix/psr7
- dev-copy_baggage
- dev-fix_bug
- dev-active
- dev-del_setTags
- dev-phpunit
- dev-travis
- dev-imp_op_b5
- dev-apache_2_license
- dev-revert-34-support-unit-testing-autoloading
- dev-for_better_english
- dev-add_zipkin_header
- dev-fix_traceid_len
- dev-require
- dev-refactor
- dev-semantic_conventions
- dev-fix_add_tags
- dev-gen128bit
This package is auto-updated.
Last update: 2024-12-15 16:57:20 UTC
README
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