1---2name: spring-boot-observability3description: Spring Boot 4 observability with Actuator, Micrometer, and OpenTelemetry. Use when configuring health indicators, health checks, custom metrics, distributed tracing, production endpoint exposure, Kubernetes probes, Cloud Run probes, logging, or monitoring. Covers Actuator endpoint security, Micrometer Timer/Counter/Gauge patterns, OpenTelemetry span customization, liveness/readiness probe setup, and metric tag best practices.4---56# Spring Boot Observability78Production observability with Actuator endpoints, Micrometer metrics, and OpenTelemetry tracing.910## Core Components1112| Component | Purpose |13|-----------|---------|14| **Actuator** | Health checks, info, metrics exposure, operational endpoints |15| **Micrometer** | Metrics abstraction (Timer, Counter, Gauge, DistributionSummary) |16| **OpenTelemetry** | Distributed tracing (default in Spring Boot 4) |1718## Core Workflow19201. **Add starters** → `actuator`, `micrometer-registry-*`, `opentelemetry`212. **Configure endpoint exposure** → Secure sensitive endpoints223. **Define health groups** → Separate liveness from readiness234. **Add custom metrics** → Business-specific measurements245. **Configure tracing** → Sampling, propagation, export2526## Quick Patterns2728See [EXAMPLES.md](EXAMPLES.md) for complete working examples including:29- **Production Actuator Configuration** with health groups and Kubernetes probes30- **Custom Health Indicator** with latency monitoring (Java + Kotlin)31- **Custom Micrometer Metrics** with Counter, Timer, and Gauge patterns32- **OpenTelemetry Span Customization** with Observation API33- **OpenTelemetry Configuration** for OTLP export34- **Actuator Endpoint Access Control** (Boot 4)3536## Spring Boot 4 Specifics3738- **OpenTelemetry** is the default tracer (replaces Brave)39- **Health Indicator** imports from `org.springframework.boot.health.contributor.*`40- **Endpoint Access Control** with `access: none/unrestricted/read-only`4142## Detailed References4344- **Examples**: See [EXAMPLES.md](EXAMPLES.md) for complete working code examples45- **Troubleshooting**: See [TROUBLESHOOTING.md](TROUBLESHOOTING.md) for common issues and Boot 4 migration46- **Actuator Endpoints**: See [references/ACTUATOR.md](references/ACTUATOR.md) for endpoint configuration, security, custom endpoints47- **Micrometer Metrics**: See [references/METRICS.md](references/METRICS.md) for Timer, Counter, Gauge, DistributionSummary patterns48- **Distributed Tracing**: See [references/TRACING.md](references/TRACING.md) for OpenTelemetry, span customization, context propagation4950## Anti-Pattern Checklist5152| Anti-Pattern | Fix |53|--------------|-----|54| DB checks in liveness probe | Move to readiness group only |55| 100% trace sampling in production | Use 10% or less |56| Exposing all endpoints publicly | Separate management port + auth |57| High-cardinality metric tags | Use low-cardinality tags only |58| Missing graceful shutdown | Add `server.shutdown=graceful` |59| No health probe groups | Separate liveness and readiness |6061## Related Skills6263| Need | Skill |64|------|-------|65| Dependency validation | `spring-boot-verify` |66| Actuator security | `spring-boot-security` |67| Actuator testing | `spring-boot-testing` |68| Module metrics | `spring-boot-modulith` |6970## Critical Reminders71721. **Separate liveness from readiness** — Liveness: "is process alive?", Readiness: "can handle traffic?"732. **Low cardinality tags only** — User IDs, request IDs = bad; status codes, regions = good743. **Secure Actuator endpoints** — Use separate port or authentication754. **Sample traces in production** — 100% sampling overwhelms collectors765. **Graceful shutdown** — Allow in-flight requests to complete