cyve / phpunit-opentelemetry-extension
PHPUnit extension for test tracing
0.1.0
2025-03-28 09:57 UTC
Requires
- php: >=8.1
- open-telemetry/api: ^1.0
- open-telemetry/sdk: ^1.2
- phpunit/phpunit: ^10.0|^11.0|^12.0
Suggests
- open-telemetry/exporter-otlp: OpenTelemetry exporter
This package is auto-updated.
Last update: 2025-03-28 10:01:08 UTC
README
PHPUnit extension for test tracing
Installation
composer require --dev cyve/phpunit-opentelemetry-extension open-telemetry/exporter-otlp
Configuration
# phpunit.xml <?xml version="1.0" encoding="UTF-8"?> <phpunit> <!-- ... --> <extensions> <bootstrap class="Cyve\OpenTelemetry\Phpunit\OpenTelemetryExtension"/> </extensions> </phpunit>
# .env.test
OTEL_SERVICE_NAME=service
OTEL_EXPORTER_OTLP_PROTOCOL=http/json
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
OTEL_SERVICE_NAME
is the name of your applicationOTEL_EXPORTER_OTLP_PROTOCOL
is any OTEL protocolOTEL_EXPORTER_OTLP_ENDPOINT
is the storage endpoint (ex: Jaeger)
Usage
Run PHPUnit tests as usual.