https://github.com/opentelemetry-php/sdk
[READONLY] The SDK for OpenTelemetry PHP
https://github.com/opentelemetry-php/sdk
Last synced: over 1 year ago
JSON representation
[READONLY] The SDK for OpenTelemetry PHP
- Host: GitHub
- URL: https://github.com/opentelemetry-php/sdk
- Owner: opentelemetry-php
- Created: 2022-05-24T16:20:04.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-02-12T22:39:16.000Z (over 1 year ago)
- Last Synced: 2025-03-29T08:04:51.635Z (over 1 year ago)
- Language: PHP
- Homepage:
- Size: 548 KB
- Stars: 15
- Watchers: 5
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://github.com/opentelemetry-php/sdk/releases)
[](https://github.com/open-telemetry/opentelemetry-php/tree/main/src/SDK)
[](https://github.com/opentelemetry-php/sdk)
[](https://packagist.org/packages/open-telemetry/sdk/)
[](https://packagist.org/packages/open-telemetry/sdk/)
# 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](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/sdk-environment-variables.md#general-sdk-configuration) is provided
SDK autoloading will be attempted as part of composer's autoloader:
```php
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](https://github.com/open-telemetry/opentelemetry-php).