PHP code example of lightstep / opencensus-exporter-zipkin

1. Go to this page and download the library: Download lightstep/opencensus-exporter-zipkin 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/ */

    

lightstep / opencensus-exporter-zipkin example snippets


    use OpenCensus\Trace\Tracer;
    use OpenCensus\Trace\Exporter\ZipkinExporter;

    Tracer::start(new ZipkinExporter('my-service-name'));
    

$exporter = new ZipkinExporter('my-service-name', LIGHTSTEP_ACCESS_TOKEN, 'http://example.com:9411/api/v2/spans');

// gethostbyname may make a DNS query, so you may want to cache this
$ipv4 = gethostbyname(gethostname());
$exporter->setLocalIpv4($ipv4);

$exporter->setLocalIpv6($ipv6);