zhaqq / zipkin
该软件包最新版本(v0.1.0)没有可用的许可信息。
fastd 的 zipkin
v0.1.0
2019-01-23 07:21 UTC
Requires
- php: >=7.1
- fastd/fastd: ^3.1
- fastd/queue: ^0.1
- openzipkin/zipkin: ^1.3
Requires (Dev)
- phpunit/phpunit: ^5.0
This package is auto-updated.
Last update: 2024-09-23 20:48:45 UTC
README
zipkin 链路分析
安装
composer require zhaqq/zipkin
示例
FastD
- 配置
cp vendor/fastd/zipkin/src/Config/zipkin.php config/zipkin.php vim config/app.php
'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()
其他
require __DIR__ . '/vendor/autoload.php'; 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(); } );