Skip to content

maciejtrybula/zipkin-opentracing-php

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zipkin OpenTracing PHP

Travis CI OpenTracing Badge Total Downloads Minimum PHP Version License

OpenTracingTracer implementation for Zipkin in PHP.

This library allows OpenTracing API consumers to use Zipkin as their tracing backend. For details on how to work with spans and traces we suggest looking at the documentation and README from the OpenTracing API.

Getting started

Required Reading

In order to understand OpenTracing API, one must first be familiar with the OpenTracing project and terminology more generally.

To understand how Zipkin and Brave work, you can look at Zipkin Architecture and Zipkin Api documentation.

Installation

composer require jcchavezs/zipkin-opentracing

Setup

Firstly, we need to setup a tracer:

use OpenTracing\GlobalTracer;
use Psr\Log\NullLogger;
use Zipkin\Endpoint;
use Zipkin\Samplers\BinarySampler;
use Zipkin\TracingBuilder;
use Zipkin\Reporters\Http;

$endpoint = Endpoint::create('my_service', '127.0.0.1', null, 8081);
$clientFactory = CurlFactory::create();
$reporter = new Zipkin\Reporters\Http($clientFactory, $logger);
$sampler = BinarySampler::createAsAlwaysSample();
$tracing = TracingBuilder::create()
	->havingLocalEndpoint($endpoint)
   ->havingSampler($sampler)
   ->havingReporter($reporter)
   ->build();

$zipkinTrcer = new ZipkinOpenTracing\Tracer($tracing);

GlobalTracer::set($tracer);

About

Zipkin bridge for OpenTracing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%