php.ini has to be updated manually (#2192)

Co-authored-by: Patrice Chalin <chalin@users.noreply.github.com>
This commit is contained in:
Przemyslaw Delewski 2023-01-24 23:22:19 +01:00 committed by GitHub
parent d0e90892b1
commit 23d6adcc5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 37 additions and 22 deletions

View File

@ -6,8 +6,8 @@ weight: 2
Automatic instrumentation with PHP requires at least PHP 8.0, and Automatic instrumentation with PHP requires at least PHP 8.0, and
[the opentelemetry PHP extension](https://github.com/open-telemetry/opentelemetry-php-instrumentation). [the opentelemetry PHP extension](https://github.com/open-telemetry/opentelemetry-php-instrumentation).
The extension allows developers code to hook into classes and methods, The extension allows developers code to hook into classes and methods, and
and execute userland code before and after. execute userland code before and after.
## Example ## Example
@ -45,26 +45,39 @@ function ends it.
## Setup ## Setup
1. Install the extension via [pickle](https://github.com/FriendsOfPHP/pickle) or [php-extension-installer](https://github.com/mlocati/docker-php-extension-installer) (docker specific): 1. Install the extension via [pickle](https://github.com/FriendsOfPHP/pickle)
or
[php-extension-installer](https://github.com/mlocati/docker-php-extension-installer)
(docker specific):
* **pickle** can be used to install extensions that are available via http://pecl.php.net, however that's not the case - **pickle** can be used to install extensions that are available via
for opentelemetry-php-instrumentation yet, so the only way for it is to install directly from source code. http://pecl.php.net, however that's not the case for
Following command line shows how to do that using specific version of extension (1.0.0beta1 in this case). opentelemetry-php-instrumentation yet, so the only way for it is to
install directly from source code. The following command line shows you
how to do that using a specific version of the extension (1.0.0beta2 in
this case):
```console ```console
$ php pickle.phar install --source https://github.com/open-telemetry/opentelemetry-php-instrumentation.git#1.0.0beta1 $ php pickle.phar install --source https://github.com/open-telemetry/opentelemetry-php-instrumentation.git#1.0.0beta2
``` ```
* **php-extension-installer**
```console
$ install-php-extensions open-telemetry/opentelemetry-php-instrumentation@main
```
2. Verify that the extension is installed and enabled: Add the extension to your `php.ini` file:
```console ```ini
$ php -m | grep otel_instrumentation [Otel instrumentation]
``` extension=otel_instrumentation.so
```
- **php-extension-installer**
```console
$ install-php-extensions open-telemetry/opentelemetry-php-instrumentation@main
```
2. Verify that the extension is installed and enabled:
```console
$ php -m | grep otel_instrumentation
```
## Zero-code configuration for automatic instrumentation ## Zero-code configuration for automatic instrumentation
@ -100,7 +113,7 @@ OpenTelemetry\API\Common\Instrumentation\Globals::registerInitializer(function (
->withPropagator($propagator); ->withPropagator($propagator);
}); });
//instrumentation libraries can access the configured providers (or a no-op implementation) via `Globals` //instrumentation libraries can access the configured providers (or a no-op implementation) via `Globals`
$tracer = Globals::tracerProvider()->getTracer('example'); $tracer = Globals::tracerProvider()->getTracer('example');
//or, via CachedInstrumentation //or, via CachedInstrumentation
$instrumentation = new CachedInstrumentation('example'); $instrumentation = new CachedInstrumentation('example');
@ -109,10 +122,12 @@ $tracerProvider = $instrumentation->tracer();
## Supported libraries and frameworks ## Supported libraries and frameworks
Automatic Instrumentation comes with a number of instrumentation libraries for commonly used PHP libraries. Automatic Instrumentation comes with a number of instrumentation libraries for
For the full list, see [instrumentation libraries on packagist](https://packagist.org/search/?query=open-telemetry&tags=instrumentation). commonly used PHP libraries. For the full list, see
[instrumentation libraries on packagist](https://packagist.org/search/?query=open-telemetry&tags=instrumentation).
## Next steps ## Next steps
After you have automatic instrumentation configured for your app or service, you After you have automatic instrumentation configured for your app or service, you
might want to add [manual instrumentation](../manual) to collect custom telemetry data. might want to add [manual instrumentation](../manual) to collect custom
telemetry data.