PHP code example of thesis / opentelemetry-grpc-transport

1. Go to this page and download the library: Download thesis/opentelemetry-grpc-transport 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/ */

    

thesis / opentelemetry-grpc-transport example snippets


use OpenTelemetry\API\Signals;
use OpenTelemetry\Contrib\Otlp\OtlpUtil;
use OpenTelemetry\Contrib\Otlp\SpanExporter;
use Thesis\OpenTelemetry\Grpc\TransportFactory;

$transport = new TransportFactory()->create(
    'http://collector:4317' . OtlpUtil::method(Signals::TRACE),
);

$exporter = new SpanExporter($transport);

use Thesis\Grpc\Client;
use Thesis\OpenTelemetry\Grpc\TransportFactory;

$factory = new TransportFactory(
    new Client\Builder()
        ->withLoadBalancer(new Client\LoadBalancer\RoundRobinFactory())
        ->withConnectionLimit(4),
);
shell
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317 php examples/otlp_grpc.php