See opentelemetry.io for more information and documentation.
Table of Contents
This is the monorepo for the main components of OpenTelemetry for PHP.
Releases for both this repository and contrib are based on read-only git subtree splits from our monorepo. You should refer to packagist.org for all packages, their versions and details.
You can also look at the read-only repositories, which live in the opentelemetry-php organization.
See Getting Started
All OpenTelemetry libraries are distributed via packagist, notably:
- API: open-telemetry/api
- SDK: open-telemetry/sdk
- Context: open-telemetry/context
- Semantic Conventions: open-telemetry/sem-conv
- Exporters: open-telemetry/exporter-*
- Extensions: open-telemetry/extension-*
- Auto-instrumentation modules: open-telemetry/opentelemetry-auto-*
The open-telemetry/opentelemetry-php-instrumentation extension can be installed to enable auto-instrumentation of PHP code (in conjunction with contrib modules).
The OpenTelemetry PHP Contrib repository hosts contributions that are not part of the core distribution or components of the library.
We attempt to keep the OpenTelemetry Specification Matrix up to date in order to show which features are available and which have not yet been implemented.
If you find an inconsistency in the data in the matrix, please let us know in our slack channel and we'll get it rectified.
See compatibility readme.
See https://opentelemetry.io/docs/php/getting-started#requirements
Your application should only depend on Interfaces provided by the API package:
$ composer require open-telemetry/api
In the best case you will use Dependency Inversion and write an adapter to not depend on the API directly.
Make sure your application works with a dependency on the API only, however to make full use of the library you want to install the SDK package and an exporter from the Contrib packages as well:
$ composer require open-telemetry/sdk
or
$ composer require open-telemetry/sdk open-telemetry/exporter-zipkin
Make sure any SDK or Contrib code is set up by your configuration, bootstrap, dependency injection, etc.
Your library should only depend on Interfaces provided by the API package:
$ composer require open-telemetry/api
For development and testing purposes you also want to install SDK and Contrib packages:
$ composer require --dev open-telemetry/sdk open-telemetry/sdk-contrib
See https://opentelemetry.io/docs/instrumentation/php/sdk#autoloading
See https://opentelemetry.io/docs/instrumentation/php/sdk#configuration
See https://opentelemetry.io/docs/instrumentation/php/automatic/
See https://opentelemetry.io/docs/instrumentation/php/propagation/
See examples/traces/demo for a working example.
You can use the zipkin example to test out the reference implementations. This example performs a sample trace with a grouping of 5 spans and exports the result to a local zipkin or jaeger instance.
If you'd like a no-fuss way to test this out with docker and docker-compose, you can perform the following simple steps:
- Install the necessary dependencies by running
make install
. - Execute the example trace using
make smoke-test-exporter-examples:
.
Exported spans can be seen in zipkin at http://127.0.0.1:9411
Exported spans can also be seen in jaeger at http://127.0.0.1:16686
Meters must be obtained from a MeterProvider
See basic example
See https://opentelemetry.io/docs/instrumentation/php/logging/
Versioning rationale can be found in the Versioning Documentation
We would love to have you on board, please see our Development README and Contributing README.