OpenTelemetryModule) so it has zero overhead when disabled. Once enabled, you can instrument web requests automatically via an interceptor, annotate individual methods for fine-grained tracing or counting, and inject telemetry beans anywhere in your application.
Prerequisites
Complete all four setup steps before enabling the module.1
Install the PHP OpenTelemetry extension
php.ini:php.ini
2
Install the Composer packages
3
Enable the module in application.yml
application.yml
4
Create opentelemetry.yaml
opentelemetry.yaml
string
required
Identifies this service in your observability backend (Jaeger, Tempo, etc.).
string
required
Export protocol —
otlp (gRPC/HTTP), zipkin, jaeger, or console.string
required
The OTel collector or backend endpoint URL.
string
default:"parent_based_always_on"
Sampling strategy —
always_on, always_off, parent_based_always_on, or traceidratio.float
default:"1.0"
Sampling ratio (0.0–1.0) used when the
traceidratio sampler is selected.Web Request Tracing
RegisterOpenTelemetryWebInterceptor in your WebMvcConfigurer to automatically create a span for every incoming HTTP request. The interceptor extracts the W3C Trace Context from request headers (enabling distributed trace propagation from upstream services), records the HTTP method, URL, and response status code, and closes the span — including exception recording — after the response is sent.
MyWebConfigurer.php
Traces, Metrics, and Logs
- Traces — #[Traceable]
- Metrics — #[Countable]
- Logs — OpenTelemetryLogs
Annotate any public bean method with
#[Traceable] to have Winter Boot automatically create an OTel span around that method’s execution. The span is named after the method by default; override the name via the name argument. Exceptions are recorded on the span and the span status is set to ERROR automatically.OrderService.php
Both
OpenTelemetryLogs and OpenTelemetryMetrics are registered as singleton beans — you can #[Autowired] them in any component without additional configuration.