Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Zipkin instrumentation for PSR18 HTTP Client

This component contains the instrumentation for the standard PSR18 HTTP clients.

Getting started

Before using this library, make sure the interfaces for PSR18 HTTP client are installed:

composer require psr/http-client

Usage

In this example we use Guzzle 7 but any HTTP client supporting PSR18 clients will work.

use GuzzleHttp\Client;
use Nyholm\Psr7\Request;
use Zipkin\Instrumentation\Http\Client\HttpClientTracing;
use Zipkin\Instrumentation\Http\Client\Psr\Client as ZipkinClient;

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

$httpClientTracing = new HttpClientTracing($tracing);
...

$httpClient = new ZipkinClient(new Client, $httpClientTracing);
$request = new Request('POST', 'http://myurl.test');
$response = $httpClient->sendRequest($request);