Skip to content

Commit

Permalink
Cleanup content/en/docs/instrumentation/php/automatic.md (open-teleme…
Browse files Browse the repository at this point in the history
…try#2528)

Co-authored-by: Phillip Carter <pcarter@fastmail.com>
  • Loading branch information
svrnm and cartermp authored Mar 24, 2023
1 parent 6d9426e commit 5f66376
Showing 1 changed file with 38 additions and 35 deletions.
73 changes: 38 additions & 35 deletions content/en/docs/instrumentation/php/automatic.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
title: Automatic Instrumentation
linkTitle: Automatic
weight: 2
spelling:
cSpell:ignore userland phar AUTOLOAD tracecontext myapp configurator packagist
---

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, and
execute userland code before and after.

Expand Down Expand Up @@ -45,53 +47,54 @@ function ends it.

## 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 for
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):
- **pickle** can be used to install extensions that are available via
<http://pecl.php.net>, however that's not the case for
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):

Installing from source requires proper development environment and few
dependencies:
Installing from source requires proper development environment and few
dependencies:

{{< ot-tabs "Linux (apt)" "macOS (homebrew)">}}
<!-- prettier-ignore-start -->

{{< ot-tab lang="shell">}} sudo apt-get install gcc make autoconf
{{< /ot-tab >}}
{{< tabpane lang=shell persistLang=false >}}

{{< ot-tab lang="shell">}} brew install gcc make autoconf {{< /ot-tab >}}
{{< tab "Linux (apt)" >}}sudo apt-get install gcc make autoconf{{< /tab >}}

{{< /ot-tabs >}}
{{< tab "MacOS (homebrew)" >}}brew install gcc make autoconf{{< /tab >}}

With your environment setup you can install the extension:
{{< /tabpane >}}
<!-- prettier-ignore-end -->

```sh
php pickle.phar install --source https://github.com/open-telemetry/opentelemetry-php-instrumentation.git#1.0.0beta2
```
With your environment setup you can install the extension:

Add the extension to your `php.ini` file:
```sh
php pickle.phar install --source https://github.com/open-telemetry/opentelemetry-php-instrumentation.git#1.0.0beta2
```

```ini
[Otel instrumentation]
extension=otel_instrumentation.so
```
Add the extension to your `php.ini` file:

- **php-extension-installer**
```sh
install-php-extensions open-telemetry/opentelemetry-php-instrumentation@main
```
```ini
[Otel instrumentation]
extension=otel_instrumentation.so
```

2. Verify that the extension is installed and enabled:
- **php-extension-installer**

```sh
php -m | grep otel_instrumentation
```
```sh
install-php-extensions open-telemetry/opentelemetry-php-instrumentation@main
```

2. Verify that the extension is installed and enabled:

```sh
php -m | grep otel_instrumentation
```

## Zero-code configuration for automatic instrumentation

Expand Down

0 comments on commit 5f66376

Please sign in to comment.