stanbic-open-telemetry / sdk-one
SDK for OpenTelemetry PHP.
Requires
- php: ^7.4 || ^8.0
- ext-json: *
- open-telemetry/api: ^1.0
- open-telemetry/context: ^1.0
- open-telemetry/sem-conv: ^1.0
- php-http/discovery: ^1.14
- psr/http-client: ^1.0
- psr/http-client-implementation: ^1.0
- psr/http-factory-implementation: ^1.0
- psr/http-message: ^1.0.1|^2.0
- psr/log: ^1.1|^2.0|^3.0
- symfony/polyfill-mbstring: ^1.23
- symfony/polyfill-php80: ^1.26
- symfony/polyfill-php81: ^1.26
- symfony/polyfill-php82: ^1.26
Suggests
- ext-gmp: To support unlimited number of synchronous metric readers
- ext-mbstring: To increase performance of string operations
This package is auto-updated.
Last update: 2024-11-07 11:40:57 UTC
README
OpenTelemetry SDK
The OpenTelemetry PHP SDK implements the API, and should be used in conjunction with contributed exporter(s) to generate and export telemetry.
Documentation
https://opentelemetry.io/docs/instrumentation/php/sdk/
Getting started
Manual setup
See https://github.com/open-telemetry/opentelemetry-php/tree/main/examples
SDK Builder
See https://github.com/open-telemetry/opentelemetry-php/blob/main/examples/sdk_builder.php
Autoloading
SDK autoloading works with configuration values provided via the environment (or php.ini).
The SDK can be automatically created and registered, if the following conditions are met:
OTEL_PHP_AUTOLOAD_ENABLED=true
- all required SDK configuration is provided
SDK autoloading will be attempted as part of composer's autoloader:
require 'vendor/autoload.php'; $tracer = \OpenTelemetry\API\Globals::tracerProvider()->getTracer('example'); $meter = \OpenTelemetry\API\Globals::meterProvider()->getMeter('example');
If autoloading was not successful (or partially successful), no-op implementations of the above may be returned.
See https://github.com/open-telemetry/opentelemetry-php/blob/main/examples/autoload_sdk.php for a more detailed example.
Contributing
This repository is a read-only git subtree split. To contribute, please see the main OpenTelemetry PHP monorepo.