https://github.com/opentelemetry-php/contrib-config-http
[READONLY] HTTP configuration
https://github.com/opentelemetry-php/contrib-config-http
Last synced: 11 days ago
JSON representation
[READONLY] HTTP configuration
- Host: GitHub
- URL: https://github.com/opentelemetry-php/contrib-config-http
- Owner: opentelemetry-php
- Created: 2026-01-17T08:17:45.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2026-05-04T12:11:30.000Z (2 months ago)
- Last Synced: 2026-05-04T14:16:32.712Z (2 months ago)
- Language: PHP
- Size: 18.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://github.com/opentelemetry-php/contrib-http-config/releases)
[](https://github.com/open-telemetry/opentelemetry-php/issues)
[](https://github.com/open-telemetry/opentelemetry-php-contrib/tree/main/src/Instrumentation/HttpConfig)
[](https://github.com/opentelemetry-php/contrib-config-http)
[](https://packagist.org/packages/open-telemetry/opentelemetry-config-http/)
[](https://packagist.org/packages/open-telemetry/opentelemetry-config-http/)
This is a read-only subtree split of https://github.com/open-telemetry/opentelemetry-php-contrib.
# OpenTelemetry HTTP configuration
Provides configuration options for HTTP instrumentation packages.
## Configuration
### File-based configuration
```yaml
instrumentation/development:
php:
http:
client:
capture_url_scheme:
capture_url_template:
capture_user_agent_original:
capture_user_agent_synthetic_type:
capture_network_transport:
capture_request_body_size:
capture_request_size:
capture_response_body_size:
capture_response_size:
server:
capture_client_port:
capture_user_agent_synthetic_type:
capture_network_transport:
capture_network_local_address:
capture_network_local_port:
capture_request_body_size:
capture_request_size:
capture_response_body_size:
capture_response_size:
uri_sanitizers:
- default:
- redact_query_string_values:
query_keys: [ passwd, secret ]
known_http_methods: [ CONNECT, DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT, QUERY, TRACE, CUSTOM ]
```
### Env-based configuration
```dotenv
OTEL_PHP_INSTRUMENTATION_URL_SANITIZE_FIELD_NAMES="passwd,secret"
OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS="CONNECT,DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT,QUERY,TRACE,CUSTOM"
```
## Usage
```php
use OpenTelemetry\API\Configuration\ConfigProperties;
use OpenTelemetry\API\Instrumentation\AutoInstrumentation\Context;
use OpenTelemetry\API\Instrumentation\AutoInstrumentation\HookManagerInterface;
use OpenTelemetry\API\Instrumentation\AutoInstrumentation\Instrumentation;
use OpenTelemetry\Contrib\Instrumentation\HttpConfig\HttpConfig;
final class CustomHttpInstrumentation implements Instrumentation
{
public function register(HookManagerInterface $hookManager, ConfigProperties $configuration, Context $context): void
{
$httpConfig = $configuration->get(HttpConfig::class) ?? new HttpConfig();
$httpConfig->...
}
}
```