2017 © Pedro Peláez
 

library zipkin-opentracing

A Zipkin bridge with OpenTracing

image

jcchavezs/zipkin-opentracing

A Zipkin bridge with OpenTracing

  • Monday, July 23, 2018
  • by jcchavezs
  • Repository
  • 1 Watchers
  • 8 Stars
  • 336 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 5 Open issues
  • 8 Versions
  • 38 % Grown

The README.md

Zipkin PHP OpenTracing

Travis CI OpenTracing Badge Total Downloads Minimum PHP Version License, (*1)

Zipkin implementation for OpenTracingTracer in PHP., (*2)

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., (*3)

Getting started

Required Reading

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

To understand how Zipkin works, you can look at Zipkin Architecture and Zipkin PHP documentation., (*5)

Installation

composer require jcchavezs/zipkin-opentracing

Usage

Firstly, we need to setup a tracer:, (*6)

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);
$reporter = new Zipkin\Reporters\Http();
$sampler = BinarySampler::createAsAlwaysSample();
$tracing = TracingBuilder::create()
    ->havingLocalEndpoint($endpoint)
    ->havingSampler($sampler)
    ->havingReporter($reporter)
    ->build();

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

GlobalTracer::set($zipkinTracer); // optional

Creating Spans

Propagation of context

Flushing Spans to the agent

PHP as a request scoped language has no simple means to pass the collected spans data to a background process without blocking the main request thread/process. It is mandatory to execute the Tracer::flush() after the response is served to the client by using register_shutdown_function., (*7)

use OpenTracing\GlobalTracer;

$application->run();

register_shutdown_function(function() {
    GlobalTracer::get()->flush();
});

Contribution

Run tests

composer test

Fix lint

composer fix-lint

The Versions

23/07 2018

dev-master

9999999-dev

A Zipkin bridge with OpenTracing

  Sources   Download

MIT

The Requires

 

The Development Requires

23/07 2018
24/04 2018

dev-start-span-implicit-parent

dev-start-span-implicit-parent

A Zipkin bridge with OpenTracing

  Sources   Download

MIT

The Requires

 

The Development Requires

24/04 2018

dev-migrate-to-beta5

dev-migrate-to-beta5

A Zipkin bridge with OpenTracing

  Sources   Download

MIT

The Requires

 

The Development Requires

13/04 2018

dev-bugfix/span-log-no-timestamp

dev-bugfix/span-log-no-timestamp

A Zipkin bridge with OpenTracing

  Sources   Download

MIT

The Requires

 

The Development Requires

11/04 2018
05/04 2018
21/03 2018

dev-adds_remote_endpoint_tags

dev-adds_remote_endpoint_tags

A Zipkin bridge with OpenTracing

  Sources   Download

MIT

The Requires

 

The Development Requires