Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Jaeger Php Laravel Package

auxmoney/jaeger-php

OpenTracing-compatible PHP client for Jaeger distributed tracing (fork of jukylin/jaeger-php). Create a Config to init a Tracer, extract SpanContext from headers/server vars, start spans, add tags/logs/baggage, then flush to send traces.

View on GitHub
Deep Wiki
Context7

jaeger-php

Tests Minimum PHP Version License Coverage Status

ATTENTION: this is a fork and republication of jukylin/jaeger-php

We opted into forking and publishing the original library in order to maintain our set of opentracing related symfony bundles. The original library seems to be unmaintained currently.

jaeger-php is a library implementing the OpenTracing specification for PHP to connect with the Jaeger Distributed Tracing Platform. It can be used to instrument PHP code to generate tracing data and send it to Jaeger.

Installation

composer require auxmoney/jaeger-php

Usage

First, you need to create a Config object, which serves as the factory to create your Tracer:

// create a config instance
$config = \Jaeger\Config::getInstance();
// create a tracer
$tracer = $config->initTracer('example service name', '0.0.0.0:6831');

To make the distributed tracing work, you need to extract your SpanContext from somewhere, e.g. $_SERVER:

$spanContext = $tracer->extract(\Opentracing\Formats\TEXT_MAP, $_SERVER);

You can then start tracing by using the common Opentracing interface:

$tracer->startActiveSpan("example operation name", ['child_of' => $spanContext]);

To add metadata to your span, you need to retrieve it first (be sure to check the semantic conventions first):

$span = $tracer->getActiveSpan();
$span->addBaggageItem("user_id", "12345");
$span->setTag("http.url", "http://localhost");
$span->log(["message" => "responded successfully"]);
$span->finish();

Finally, at the end of your script, you should flush the original Config. This will flush all created Tracers and all created Spans:

$config->flush();

optional configuration

// optional: generate 128 bit trace ids (default: false)
$config->gen128bit();
// optional: disable tracing (default: false)
$config->setDisabled(true);
// optional: inject custom transport (default: TransportUdp)
$config->setTransport($transport);
// optional: inject custom reporter (default: RemoteReporter)
$config->setReporter($reporter);
// optional: inject custom sampler (default: ConstSampler)
$config->setSampler($sampler);

Special thanks

Thank you, @jukylin, for creating this library!

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui