Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update PHP zero-code docs #6063

Merged
merged 2 commits into from
Jan 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions content/en/docs/zero-code/php.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ Automatic instrumentation with PHP requires:
[instrumentation libraries](/ecosystem/registry/?component=instrumentation&language=php)
- [Configuration](#configuration)

## Install the OpenTelemetry extension

{{% alert title="Important" color="warning" %}}Installing the OpenTelemetry
extension by itself does not generate traces. {{% /alert %}}

## Install the OpenTelemetry extension

The extension can be installed via pecl,
[pickle](https://github.com/FriendsOfPHP/pickle) or
[php-extension-installer](https://github.com/mlocati/docker-php-extension-installer)
Expand Down Expand Up @@ -130,13 +130,16 @@ Automatic instrumentation is available for a number commonly used PHP libraries.
For the full list, see
[instrumentation libraries on packagist](https://packagist.org/search/?query=open-telemetry&tags=instrumentation).

Let's assume that your application uses Slim Framework and a PSR-18 HTTP client.
You would then install the SDK and corresponding auto-instrumentation packages
for these:
Let's assume that your application uses Slim Framework and a PSR-18 HTTP client,
and that we will export the traces with the OTLP protocol.

You would then install the SDK, an exporter, and auto-instrumentation packages
for Slim Framework and PSR-18:

```shell
composer require \
open-telemetry/sdk \
open-telemetry/exporter-otlp \
open-telemetry/opentelemetry-auto-slim \
open-telemetry/opentelemetry-auto-psr18
```
Expand All @@ -152,8 +155,8 @@ variables or the `php.ini` file to configure auto-instrumentation.
OTEL_PHP_AUTOLOAD_ENABLED=true \
OTEL_SERVICE_NAME=your-service-name \
OTEL_TRACES_EXPORTER=otlp \
OTEL_EXPORTER_OTLP_PROTOCOL=grpc \
OTEL_EXPORTER_OTLP_ENDPOINT=http://collector:4317 \
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \
OTEL_EXPORTER_OTLP_ENDPOINT=http://collector:4318 \
OTEL_PROPAGATORS=baggage,tracecontext \
php myapp.php
```
Expand All @@ -167,8 +170,8 @@ by PHP:
OTEL_PHP_AUTOLOAD_ENABLED="true"
OTEL_SERVICE_NAME=your-service-name
OTEL_TRACES_EXPORTER=otlp
OTEL_EXPORTER_OTLP_PROTOCOL=grpc
OTEL_EXPORTER_OTLP_ENDPOINT=http://collector:4317
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
OTEL_EXPORTER_OTLP_ENDPOINT=http://collector:4318
OTEL_PROPAGATORS=baggage,tracecontext
```

Expand Down
Loading