PHP code example of jcchavezs / zipkin-instrumentation-guzzle

1. Go to this page and download the library: Download jcchavezs/zipkin-instrumentation-guzzle 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/ */

    

jcchavezs / zipkin-instrumentation-guzzle example snippets


use Zipkin\TracingBuilder;
use ZipkinGuzzle\Middleware;

$tracing = TracingBuilder::create()->build();

// Default tags for all spans being created. They are not mandatory.
$tags = [
   'instance' => $_SERVER['SERVER_NAME']
];

$client = new Client([
    'handler' => Middleware\handlerStack($tracing, $tags),
]);

use GuzzleHttp\HandlerStack;
use Zipkin\TracingBuilder;
use ZipkinGuzzle\Middleware;

$tracing = TracingBuilder::create()->build();

$stack = HandlerStack::create();
$stack->push(someMiddleware());
...
$stack->push(Middleware\tracing($tracing));

$client = new Client([
    'handler' => $stack,
]);