Download the PHP package wizofgoz/laravel-opentracing without Composer
On this page you can find all versions of the php package wizofgoz/laravel-opentracing. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-opentracing
OpenTracing for Laravel
Reference implementation of the OpenTracing API for Laravel including a server-less local tracer for application logging purposes.
See OpenTracing for more information.
Supported Clients
Currently supported clients:
- Local: No-op tracer used mainly for adding trace ids to logs.
- Jaeger: open source, end-to-end distributed tracing. See Jaeger and Jonah George's Jaeger Client PHP.
Installation
Install the latest version using:
Copy the default configuration file to your application if you want to change it by running the command below. Note
that you have to use --force
if the file already exists.
Basic Usage
Example setup
Example bootstrap/app.php
file:
Tracing
To trace a specific process in your application you can wrap the process in a trace closure using the provided facade as shown below. This will take care of starting a new trace span and closing it again when the closure either returns or throws.
Nested traces are also possible like below. It will automatically take care of the span child/parent relations.
If you want to add context information or tags to your spans, it is possible like below.
Helper functions are provided for all functions available on the facade.
Common Tags
This package provides resolvers for common tags from a given context such as an Eloquent Query Builder, Request object, or Response object. These can be overridden in configuration like below.
There are helper functions available for deriving tags from contexts based on the current configuration.
Tracing Jobs
All jobs can be automatically traced by using the enable_jobs
boolean in the configuration file or for tracing on certain jobs, attach the provided middleware to the ones you wish to trace.
Tracing Across Service Boundaries
Trace contexts can easily be used across services. If your application starts a tracing context, that context can be carried over HTTP to another service with an OpenTracing compatible implementation.
To automatically accept trace contexts from other services, add the tracing middleware to your application by adding it
to your app/Http/Kernel.php
file like below:
Assuming your application uses GuzzleHttp for sending requests to external services, you can use the provided tracing handler when creating the client like below. This will automatically send the necessary trace context headers with the HTTP request to the external service.
Testing
docker run --rm -it -v $(pwd):/app php:7.3-cli-alpine /bin/sh -c 'apk add --no-cache $PHPIZE_DEPS && pecl install xdebug-2.7.2 && cd app && php -dzend_extension=xdebug.so vendor/bin/phpunit'
About
Requirements
- PHP 7.3 or newer.
Contributions
Bugs and feature requests are tracked on GitHub.
License
OpenTracing for Laravel is licensed under the Apache-2.0 license. See the LICENSE file for details.
All versions of laravel-opentracing with dependencies
guzzlehttp/guzzle Version ^6.2
illuminate/support Version ^7.0
jonahgeorge/jaeger-client-php Version ^0.6.0
opentracing/opentracing Version ^1.0.0-beta6
psr/cache Version ~1.0.1