php zipkin
1.0.0
Ini adalah perpustakaan PHP tidak resmi untuk OpenZipkin.
Tidak lengkap, hanya memiliki satu transportasi dengan nol integrasi. Pustaka ini berisi implementasi yang sangat minimal hanya untuk mengirimkan span ke zipkin.
Cara yang disarankan untuk menginstal PHP-Zipkin adalah melalui Composer
composer require drefined/php-zipkin
<?php
$ client = new GuzzleHttp Client ();
$ logger = new Drefined Zipkin Transport HTTPLogger ( $ client );
$ tracer = new Drefined Zipkin Tracer ( $ logger , 1.0 , true );
$ endpoint = new Drefined Zipkin Core Endpoint ( ' 127.0.0.1 ' , 8080 , ' test-trace ' );
$ trace = new Drefined Zipkin Core Trace ( $ tracer , $ endpoint );
$ trace -> createNewSpan ( ' test-server-trace ' );
$ trace -> record (
[Annotation:: generateServerRecv ()],
[BinaryAnnotation:: generateString ( ' server.request.uri ' , ' /server ' )]
);
$ trace -> record (
[Annotation:: generateServerSend ()],
[BinaryAnnotation:: generateString ( ' server.response ' , 200 )]
);
Tambahkan middleware dan penyedia layanan di lokasi yang tepat.
<?php // laravel-project/app/Http/Kernel.php
namespace App Http ;
use ...
use Drefined Zipkin Instrumentation Laravel Middleware EnableZipkinTracing ;
class Kernel extends HttpKernel
{
...
protected $ middleware = [
...
EnableZipkinTracing::class,
];
. . .
}
<?php // laravel-project/config/app.php
use Drefined Zipkin Instrumentation Laravel Providers ZipkinTracingServiceProvider ;
return [
...
' providers ' => [
...
ZipkinTracingServiceProvider::class,
],
...
];