Spring Boot 4 OpenTelemetry: From Zero to Full Observability in Minutes

This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).

Spring Boot 4.0.1 introduces an official OpenTelemetry starter that enables observability without requiring the full Actuator dependency. The tutorial walks through setting up a new Spring Boot 4 project with the spring-boot-starter-opentelemetry dependency, Docker Compose support for the Grafana LGTM stack (Loki, Grafana, Tempo, Mimir), and configuring metrics, traces, and logs export via OTLP. Key steps include setting tracing probability to 1.0 for development, configuring OTLP collector endpoints, creating REST endpoints to generate traffic, and viewing traces and metrics in Grafana. Log export via OTLP (new in 4.0.1) requires adding the logback-appender dependency, a logback-spring.xml config, and a component to wire the OpenTelemetry instance into the appender. Custom metrics can be added via the ObservationRegistry or the @Observed annotation with Spring AOP.

22m watch time

Sort: