OpenTelemetry PHP Configuration

Ship traces from PHP to OpenSearch with OpenTelemetry

Use OpenTelemetry to easily send PHP traces to your Logit.io Stack.

Install Integration

Please click on the Install Integration button to configure your stack for this source.

Getting Started

You can get help Getting Started with OpenTelemetry for PHP by referring to the official documentation (opens in a new tab).

You need to configure the OTLP exporter to ensure the trace data reaches your Logit.io Stack.

OTLP HTTP/S Exporter settings:

<?php
 
require __DIR__ . '/vendor/autoload.php';
 
use OpenTelemetry\Contrib\Otlp\OtlpHttpTransportFactory;
use OpenTelemetry\Contrib\Otlp\SpanExporter;
use OpenTelemetry\SDK\Trace\SpanProcessor\SimpleSpanProcessor;
use OpenTelemetry\SDK\Trace\TracerProvider;
 
$transport = (new OtlpHttpTransportFactory())->create(
  'https://@opentelemetry.endpointAddress:@opentelemetry.httpsPort', 
  'application/x-protobuf', 
  ['Authorization' => 'Basic @opentelemetry.base64encodedAuthString']);
$exporter = new SpanExporter($transport);
 
$tracerProvider =  new TracerProvider(
    new SimpleSpanProcessor($exporter)
);

For more information about exporter configuration with PHP please refer to the official documentation (opens in a new tab).

Launch Logit.io to view your traces

Data should now have been sent to your Stack.

View My Data

If you don't see take a look at How to diagnose no data in Stack below for how to diagnose common issues.

How to diagnose no data in Stack

If you don't see data appearing in your Stack after following the steps, visit the Help Centre guide for steps to diagnose no data appearing in your Stack or Chat to support now.