Skip to content

Commit a52398d

Browse files
authored
document OTEL_PHP_EXCLUDED_URLS (#3952)
1 parent 5033234 commit a52398d

File tree

1 file changed

+24
-8
lines changed
  • content/en/docs/languages/php

1 file changed

+24
-8
lines changed

content/en/docs/languages/php/sdk.md

+24-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title: SDK
33
weight: 100
4+
cSpell:ignore: healthcheck
45
---
56

67
The OpenTelemetry SDK provides a working implementation of the API, and can be
@@ -97,6 +98,20 @@ $meter = OpenTelemetry\API\Globals::meterProvider()->getMeter('name', 'version',
9798

9899
SDK autoloading happens as part of the composer autoloader.
99100

101+
### Excluded URLs
102+
103+
You can disable SDK autoloading if the request URL matches a regular expression.
104+
Matching an excluded URL prevents any telemetry from being generated or
105+
exported. You can use this feature in a shared-nothing PHP runtime like Apache
106+
or NGINX, for requests such as health checks.
107+
108+
For example, the following configuration turns off telemetry for requests such
109+
as `https://site/client/123/info` and `https://site/xyz/healthcheck`:
110+
111+
```shell
112+
OTEL_PHP_EXCLUDED_URLS="client/.*/info,healthcheck"
113+
```
114+
100115
## Configuration
101116

102117
The PHP SDK supports most of the available
@@ -106,14 +121,15 @@ details, see the
106121

107122
There are also a number of PHP-specific configurations:
108123

109-
| Name | Default value | Values | Example | Description |
110-
| ------------------------------------ | ------------- | ------------------------------------------------------------------------------------- | ---------------- | ---------------------------------------------------------------------------------- |
111-
| `OTEL_PHP_TRACES_PROCESSOR` | `batch` | `batch`, `simple` | `simple` | Span processor selection |
112-
| `OTEL_PHP_DETECTORS` | `all` | `env`, `host`, `os`, `process`, `process_runtime`, `sdk`, `sdk_provided`, `container` | `env,os,process` | Resource detector selection |
113-
| `OTEL_PHP_AUTOLOAD_ENABLED` | `false` | `true`, `false` | `true` | Enable/disable SDK autoloading |
114-
| `OTEL_PHP_LOG_DESTINATION` | `default` | `error_log`, `stderr`, `stdout`, `psr3`, `none` | `stderr` | Where internal errors and warnings will be sent |
115-
| `OTEL_PHP_INTERNAL_METRICS_ENABLED` | `false` | `true`, `false` | `true` | Whether the SDK should emit metrics about its internal state (eg batch processors) |
116-
| `OTEL_PHP_DISABLED_INSTRUMENTATIONS` | `[]` | Instrumentation name(s), or `all` | `psr15,psr18` | Disable one or more installed auto-instrumentations |
124+
| Name | Default value | Values | Example | Description |
125+
| ------------------------------------ | ------------- | ------------------------------------------------------------------------------------- | ---------------------------- | -------------------------------------------------------------------------------------------- |
126+
| `OTEL_PHP_TRACES_PROCESSOR` | `batch` | `batch`, `simple` | `simple` | Span processor selection |
127+
| `OTEL_PHP_DETECTORS` | `all` | `env`, `host`, `os`, `process`, `process_runtime`, `sdk`, `sdk_provided`, `container` | `env,os,process` | Resource detector selection |
128+
| `OTEL_PHP_AUTOLOAD_ENABLED` | `false` | `true`, `false` | `true` | Enable/disable SDK autoloading |
129+
| `OTEL_PHP_LOG_DESTINATION` | `default` | `error_log`, `stderr`, `stdout`, `psr3`, `none` | `stderr` | Where internal errors and warnings will be sent |
130+
| `OTEL_PHP_INTERNAL_METRICS_ENABLED` | `false` | `true`, `false` | `true` | Whether the SDK should emit metrics about its internal state (for example, batch processors) |
131+
| `OTEL_PHP_DISABLED_INSTRUMENTATIONS` | `[]` | Instrumentation names, or `all` | `psr15,psr18` | Disable one or more installed auto-instrumentations |
132+
| `OTEL_PHP_EXCLUDED_URLS` | `` | Comma-delimited regular expression patterns | `client/.*/info,healthcheck` | Do not load the SDK if request URL matches one of the supplied regular expressions |
117133

118134
Configurations can be provided as environment variables, or via `php.ini` (or a
119135
file included by `php.ini`)

0 commit comments

Comments
 (0)