Coder Social home page Coder Social logo

php-zipkin's Introduction

PHP-Zipkin

This is an unofficial PHP library for OpenZipkin.

Status

Incomplete, only has one transport with zero integrations. This library contains a very minimal implementation for just sending spans to zipkin.

Getting started

The recommended way to install PHP-Zipkin is through Composer

composer require drefined/php-zipkin

Example usage

<?php
$client   = new \GuzzleHttp\Client();
$logger   = new \Drefined\Zipkin\Transport\HTTPLogger($client);
$tracer   = new \Drefined\Zipkin\Tracer($logger, 1.0, true);
$endpoint = new \Drefined\Zipkin\Core\Endpoint('127.0.0.1', 8080, 'test-trace');
$trace    = new \Drefined\Zipkin\Core\Trace($tracer, $endpoint);

$trace->createNewSpan('test-server-trace');

$trace->record(
    [Annotation::generateServerRecv()],
    [BinaryAnnotation::generateString('server.request.uri', '/server')]
);

$trace->record(
    [Annotation::generateServerSend()],
    [BinaryAnnotation::generateString('server.response', 200)]
);

Laravel integration (simple)

Add middleware and service provider in proper locations.

<?php // laravel-project/app/Http/Kernel.php

namespace App\Http;

use ...
use Drefined\Zipkin\Instrumentation\Laravel\Middleware\EnableZipkinTracing;

class Kernel extends HttpKernel
{
    ...
    protected $middleware = [
        ...
        EnableZipkinTracing::class,
    ];
    ...
}
<?php // laravel-project/config/app.php

use Drefined\Zipkin\Instrumentation\Laravel\Providers\ZipkinTracingServiceProvider;

return [
    ...
    'providers' => [
        ...
        ZipkinTracingServiceProvider::class,
    ],
    ...
];

Todo

  • Add Complete Laravel integration (currently supports a simple implementation without app environment configuration)
  • Add Symfony integration
  • Add Redis wrapper
  • Add HTTP wrapper
  • Add PDO wrapper
  • Add Scribe transport
  • Add Kafka transport

Inspired By

Reference

Generating PHP thrift classes

  • ls thrift/ | xargs -I {} thrift --gen php thrift/{}

License

license

Contributors

  • David Phruksukarn

php-zipkin's People

Contributors

drefined avatar

Watchers

James Cloos avatar Tomas Bartkus avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.