open-telemetry / opentelemetry-auto-reactphp
OpenTelemetry auto-instrumentation for ReactPHP's HTTP Browser.
Requires
- php: ^8.1
- ext-opentelemetry: *
- guzzlehttp/psr7: ^2.7
- open-telemetry/api: ^1.0
- open-telemetry/sem-conv: ^1.32
- react/http: ^1.11.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3
- open-telemetry/sdk: ^1.0
- phan/phan: ^5.0
- phpstan/phpstan: ^1.1
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
- psalm/plugin-phpunit: ^0.19.2
- react/async: ^4.3.0
- vimeo/psalm: 6.4.0
README
This is a read-only subtree split of https://github.com/open-telemetry/opentelemetry-php-contrib.
OpenTelemetry ReactPHP HTTP Browser auto-instrumentation
This is an OpenTelemetry auto-instrumentation package for the ReactPHP HTTP library. Currently only the Browser (client) component is instrumented.
Please read https://opentelemetry.io/docs/instrumentation/php/automatic/ for instructions on how to install and configure the extension and SDK.
Overview
This library is provides the following:
- OpenTelemetry Semantic Conventions v1.32.0:
- HTTP Client Spans - required and HTTP header (opt-in) attributes only
- HTTP Client Metrics - required attributes only
- W3C Trace Context:
Note
HTTP Client Span lifetime behavior differs based on how ReactPHP is utilized; see examples/README.md for more information.
Configuration
The extension can be disabled via runtime configuration:
OTEL_PHP_DISABLED_INSTRUMENTATIONS=reactphp
Custom HTTP methods can replace the known methods via an environment variable, e.g.:
OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS="GET,HEAD,POST,PUT,DELETE,CONNECT,OPTIONS,TRACE,PATCH,MyCustomMethod"
Additional HTTP query string parameters can be redacted via an environment variable, e.g.,
OTEL_PHP_INSTRUMENTATION_URL_SANITIZE_FIELD_NAMES="password,passwd,pwd,secret"
Request and/or response headers can be added as span attributes via environment variables, e.g.:
OTEL_PHP_INSTRUMENTATION_HTTP_REQUEST_HEADERS=Accept
OTEL_PHP_INSTRUMENTATION_HTTP_RESPONSE_HEADERS="Content-Length,Content-Type"