Download the PHP package icovn/laravel-zipkin without Composer
On this page you can find all versions of the php package icovn/laravel-zipkin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download icovn/laravel-zipkin
More information about icovn/laravel-zipkin
Files in icovn/laravel-zipkin
Informations about the package laravel-zipkin
Laravel Zipkin
A library wants to help the use Openzipkin for Laravel.
Table of contents
- Installation
- Configuration
- Automatic API tracing
- Usage
- Dependency
- BaseController
- Create trace and rootSpan
- Child span
- Contact
- License
Installation
Laravel version Compatibility
Laravel | Package |
---|---|
5.x | not tested |
>= 6.x.x | 1.0.x |
Requirements
No requirements are necessary.
Installation
-
Installation using composer:
-
And add the service provider in
config/app.php
: - You may also register an alias for the ZipkinService by adding the following to the alias array in
config/app.php
:
Configuration
Run the command below to publish the package config file config/zipkin.php
:
in your .env
file define these parameters and set up your configuration:
Automatic API tracing
The library offer an automatic tracing of request, in particular about your API. In order to use this automatic tracing you have:
-
Insert the middleware in your
app/Kernel.php
where do you want automatic tracing. For example you can use in api block: - Each controller of Api must extends
ZipkinBaseController
(check BaseController):
Usage
Dependency
You can easly access to ZipkinService by dependency injection. In your Controller
you can access in this way:
BaseController
If you want to automatize child span between controllers and methods, you can use ZipkinBaseController
and foreach method called in Controller he create automatically a span for the current rootSpan instance.
note: ZipkinBaseController doen't create rootSpan, so you have to create before methods are called. For example in middleware.
In this way you don't need to access to $zipkinService
in __construct
, but if you need to override it you have to call parent constructor:
note: in your MyAwesomeController
now you can access to ZipkinService with public variable of ZipkinBaseController
:
Create trace and rootSpan
In order to create a rootSpan you can use this code
Child span
To create a child span:
Contact
Open an issue on GitHub if you have any problems or suggestions.
License
The contents of this repository is released under the MIT license.