PHP code example of zhaqq / zipkin
1. Go to this page and download the library: Download zhaqq/zipkin library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
zhaqq / zipkin example snippets
'services' => [
\FastD\ServiceProvider\CacheServiceProvider::class,
\FastD\ServiceProvider\LoggerServiceProvider::class,
\FastD\ServiceProvider\RouteServiceProvider::class,
// add Zipkin
\Zhaqq\Zipkin\Provider\ZipkinProvider::class,
],
// use callback
$response = app()->get('zipkin')->childSpan(
function () use () {
// do something
return something
return $response;
}, 'server name', 'SERVER or CLIENT or ...', annotate[string or array], tag[array]
);
//or use method
app()->get('zipkin')->child($name, $kind = Zipkin::SERVER, $annotate = null, array $tag = [])
// do something
app()->get('zipkin')->childFinished()
use Zhaqq\Zipkin\Span;
$span = new Span();
$span->instance(string $name, $options = [], $isParent = true);
// do something
$span->childSpan(callable $request, $name, $kind = Zipkin::SERVER, $annotate = null, array $tag = [])
// do something
register_shutdown_function(
function () use ($span) {
$span->finised();
}
);
shell
cp vendor/fastd/zipkin/src/Config/zipkin.php config/zipkin.php
vim config/app.php