Spring / Spring Boot 4 Basics Interview Questions
What is Spring Boot's observability stack in Boot 4 with Micrometer and OpenTelemetry?
Spring Boot 4 builds observability around Micrometer (metrics), Micrometer Tracing (distributed tracing), and OpenTelemetry (standard telemetry export). The management.opentelemetry.* property namespace is new in Boot 4.
| Pillar | Library | What it tracks |
|---|---|---|
| Metrics | Micrometer | HTTP request rates, JVM heap, GC, custom counters/gauges |
| Tracing | Micrometer Tracing + OTel | Distributed request traces across services |
| Logging | SLF4J + Logback/Log4j2 | Structured application logs |
| Health | Spring Boot Actuator | Component health and readiness |
// Custom metrics with Micrometer: @Service public class OrderService { private final Counter orderCounter; private final Timer orderTimer; public OrderService(MeterRegistry registry) { this.orderCounter = Counter.builder("orders.created") .description("Total orders created") .tag("environment", "prod") .register(registry); this.orderTimer = Timer.builder("orders.processing.time") .description("Time to process order") .register(registry); } public Order placeOrder(CreateOrderRequest request) { return orderTimer.record(() -> { Order order = doCreateOrder(request); orderCounter.increment(); return order; }); } } # application.yml: OpenTelemetry configuration (Boot 4) management: opentelemetry: resource-attributes: service.name: order-service service.version: "2.1.0" deployment.environment: production tracing: sampling: probability: 0.1 # 10% sampling in production metrics: export: prometheus: enabled: true # expose /actuator/prometheus # Export traces to Jaeger / Zipkin / OTel Collector: management.otlp.tracing.endpoint=http://otel-collector:4317/v1/traces
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
