Skip to content

khunafin/opentracing-grpc-interceptor

Repository files navigation

opentracing-grpc-interceptor

Usage example

use Grpc\Internal\InterceptorChannel;
use OpenTracingInterceptor\Interceptor;
use Acme\Tracer;
use Foo\Bar\SomeGrpcClient;
use Foo\Bar\SomeGrpcMethodArgs;

$host = 'grpc.server.com:1313';
$tracer =  new Tracer();

$channel = SomeGrpcClient::getDefaultChannel($host);
$openTracingInterceptor = new Interceptor($tracer);
$interceptor = new InterceptorChannel($channel, $openTracingInterceptor);

$rootSpan = $tracer->startSpan("rootSpan");

$client = new SomeGrpcClient($host, [], $interceptor);
$args = new SomeGrpcMethodArgs();
$options = [
    'child_of' => $rootSpan
];
$result = $client->SomeGrpcMethodCall($args, [], $options);

$rootSpan->finish();
$tracer->flush();

Reference

OpenTracing

Jaeger

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages