Download the PHP package vantt/opentracing-jaeger-php without Composer
On this page you can find all versions of the php package vantt/opentracing-jaeger-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vantt/opentracing-jaeger-php
More information about vantt/opentracing-jaeger-php
Files in vantt/opentracing-jaeger-php
Package opentracing-jaeger-php
Short Description php opentracing client for jaeger
License Apache-2.0
Informations about the package opentracing-jaeger-php
jaeger-php
Install
Install via composer.
Init Jaeger-php
128bit
Extracting span context from request header
Injecting span context into request header
Usage
Using SpanBuilder
This library extends the original api to add a new method buildSpan(operationName):SpanBuilderInterface.
When consuming this library one really only need to worry about the buildSpan(operationName) on the $tracer instance: Tracer::buildSpan(operationName)
With SpanBuilder, we can leverage the power of editor to do auto code completion for us with following APIs:
asChildOf($parentContext)is an object of typeOpenTracing\SpanContextorOpenTracing\Span.withStartTimestamp(time())is a float, int or\DateTimerepresenting a timestamp with arbitrary precision.withTag(key,val)is an array with string keys and scalar values that represent OpenTracing tags.ignoreActiveSpan(bool)finishSpanOnClose()is a boolean that determines whether a span should be finished or not when the scope is closed.addReference()
Here are code snippets demonstrating some important use cases:
Creating a Span given an existing Request
To start a new Span, you can use the startSpan method.
Starting a new trace by creating a "root span"
It's always possible to create a "root" Span with no parent or other causal reference.
Active Spans and Scope Manager
For most use cases, it is recommended that you use the Tracer::startActiveSpan function for
creating new spans.
An example of a linear, two level deep span tree using active spans looks like this in PHP code:
When using the Tracer::startActiveSpan function the underlying tracer uses an
abstraction called scope manager to keep track of the currently active span.
Starting an active span will always use the currently active span as a parent. If no parent is available, then the newly created span is considered to be the root span of the trace.
Unless you are using asynchronous code that tracks multiple spans at the same
time, such as when using cURL Multi Exec or MySQLi Polling it is recommended that you
use Tracer::startActiveSpan everywhere in your application.
The currently active span gets automatically finished when you call $scope->close()
as you can see in the previous examples.
If you don't want a span to automatically close when $scope->close() is called
then you must specify 'finish_span_on_close'=> false, in the $options
argument of startActiveSpan.
Creating a child span assigning parent manually
Creating a child span using automatic active span management
Every new span will take the active span as parent and it will take its spot.
Serializing to the wire
Deserializing from the wire
When using http header for context propagation you can use either the Request or the $_SERVER
variable:
Start Span
Distributed context propagation
Inject into Superglobals
Tags and Log
Close Tracer
Zipkin B3 Propagation
no support for Distributed context propagation
Finish span and flush Tracer
Features
-
Transports
- via Thrift over UDP
- Sampling
- ConstSampler
- ProbabilisticSampler