Skip to content

Commit f8ad406

Browse files
committed
update PHP zero-code docs
- install otlp exporter - use http/protobuf by default - minor editorialization
1 parent b60cf33 commit f8ad406

File tree

1 file changed

+12
-9
lines changed
  • content/en/docs/zero-code

1 file changed

+12
-9
lines changed

content/en/docs/zero-code/php.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ Automatic instrumentation with PHP requires:
1818
[instrumentation libraries](/ecosystem/registry/?component=instrumentation&language=php)
1919
- [Configuration](#configuration)
2020

21+
## Install the OpenTelemetry extension
22+
2123
{{% alert title="Important" color="warning" %}}Installing the OpenTelemetry
2224
extension by itself does not generate traces. {{% /alert %}}
2325

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

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

137139
```shell
138140
composer require \
139141
open-telemetry/sdk \
142+
open-telemetry/exporter-otlp \
140143
open-telemetry/opentelemetry-auto-slim \
141144
open-telemetry/opentelemetry-auto-psr18
142145
```
@@ -152,8 +155,8 @@ variables or the `php.ini` file to configure auto-instrumentation.
152155
OTEL_PHP_AUTOLOAD_ENABLED=true \
153156
OTEL_SERVICE_NAME=your-service-name \
154157
OTEL_TRACES_EXPORTER=otlp \
155-
OTEL_EXPORTER_OTLP_PROTOCOL=grpc \
156-
OTEL_EXPORTER_OTLP_ENDPOINT=http://collector:4317 \
158+
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \
159+
OTEL_EXPORTER_OTLP_ENDPOINT=http://collector:4318 \
157160
OTEL_PROPAGATORS=baggage,tracecontext \
158161
php myapp.php
159162
```
@@ -167,8 +170,8 @@ by PHP:
167170
OTEL_PHP_AUTOLOAD_ENABLED="true"
168171
OTEL_SERVICE_NAME=your-service-name
169172
OTEL_TRACES_EXPORTER=otlp
170-
OTEL_EXPORTER_OTLP_PROTOCOL=grpc
171-
OTEL_EXPORTER_OTLP_ENDPOINT=http://collector:4317
173+
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
174+
OTEL_EXPORTER_OTLP_ENDPOINT=http://collector:4318
172175
OTEL_PROPAGATORS=baggage,tracecontext
173176
```
174177

0 commit comments

Comments
 (0)