This component contains the instrumentation for the standard PSR18 HTTP clients.
Before using this library, make sure the interfaces for PSR18 HTTP client are installed:
composer require psr/http-client
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);