cross-cutting

Actuator: Health, Metrics, Tracing

Expose operational endpoints (health, metrics, info, threads, env) for monitoring, alerting, and on-call diagnosis.

An application running in production is a black box unless it exposes its own operational state. Spring Boot Actuator adds that observability layer out of the box: a set of HTTP (or JMX) endpoints that report health, metrics, configuration, and internals, so monitoring systems, load balancers, and on-call engineers can see what the service is doing without attaching a debugger.

Aircraft instrument panel — altitude, fuel, engine temperature. Without it, you're flying blind.

Key Concepts

1
Adding the spring-boot-starter-actuator dependency exposes endpoints under /actuator. The most important is /health, which aggregates health indicators for the datasource, disk space, message brokers, and any custom checks into a single UP/DOWN status — exactly what a Kubernetes liveness/readiness probe or a load balancer polls to decide whether to route traffic. /metrics (backed by Micrometer) publishes counters, gauges, and timers — request rates, latencies, JVM memory, garbage-collection pauses, thread counts — in a form Prometheus can scrape and Grafana can chart. Others round out diagnosis: /info for build and version data, /env for resolved configuration, /loggers to change log levels at runtime, and /threaddump and /heapdump for incident analysis. Micrometer acts as a vendor-neutral facade, so the same instrumentation can feed Prometheus, Datadog, or CloudWatch.
spring-boot-starter-actuator/actuator/health/metrics/info
2
The non-negotiable point for interviews is security: these endpoints reveal sensitive operational detail, so only /health (and often /info) should be publicly reachable, while /env, /heapdump, and the rest must be locked down or exposed only on an internal management port. By default Boot exposes a conservative subset over HTTP for this reason. The broader framing is that Actuator is the foundation of the three pillars of observability — health and metrics here, paired with structured logging and distributed tracing — that make a service operable in production.
/health/info/env/heapdump
3
What the interviewer is probing.
What the interviewer is probing.
4
1. "What does Actuator expose and what is the caution?" *Probing:* the balance. *Stalls:* "Endpoints." *Moves up:* health, metrics, environment, mappings and more — and they must be secured, since env and configprops leak configuration.
1. "What does Actuator expose and what is the caution?"
5
2. "What is the difference between liveness and readiness?" *Probing:* the operational detail. *Stalls:* "Nothing." *Moves up:* liveness failing means restart me; readiness failing means stop sending traffic but do not restart.
2. "What is the difference between liveness and readiness?"
6
3. "Why does confusing them cause outages?" *Probing:* the consequence. *Stalls:* "It does not." *Moves up:* a readiness condition wired to liveness restarts pods during a dependency blip, turning a degradation into a crash loop.
3. "Why does confusing them cause outages?"
7
4. "How do metrics reach a monitoring system?" *Probing:* the mechanism. *Stalls:* "Logs." *Moves up:* Micrometer as the facade, with a registry per backend — so the application code does not know whether it is Prometheus or otherwise.
4. "How do metrics reach a monitoring system?"