Skip to main content
Winter Boot provides first-class integration with OpenTelemetry (OTel), covering all three observability pillars: distributed traces, metrics, and structured logs. The integration is delivered as an optional module (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

Then enable it in your php.ini:
php.ini
If the extension is not loaded, OpenTelemetryModule will throw a MissingExtensionException at application startup.
2

Install the Composer packages

3

Enable the module in application.yml

application.yml
4

Create opentelemetry.yaml

opentelemetry.yaml
Key configuration fields:
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

Register OpenTelemetryWebInterceptor 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

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.