Spring Boot Monitoring with Actuator 2 — Questions and Answers
Question 1: Which Spring Boot Actuator endpoint returns a live application status suitable for Kubernetes liveness probes?
- /actuator/health/liveness (Correct answer)
- /actuator/alive
- /actuator/ping
- /actuator/status
Correct answer: /actuator/health/liveness
The /actuator/health/liveness endpoint maps to the liveness state and is designed for Kubernetes liveness probes.
Question 2: What property enables all Actuator endpoints to be exposed over HTTP in Spring Boot 2.x?
- management.endpoints.web.exposure.include=* (Correct answer)
- management.endpoints.expose=all
- actuator.endpoints.enabled=true
- spring.actuator.web.expose=all
Correct answer: management.endpoints.web.exposure.include=*
Setting management.endpoints.web.exposure.include=* exposes all available endpoints over HTTP.
Question 3: Which Actuator endpoint provides a trace of the last HTTP requests received by the application?
- /actuator/httptrace (Correct answer)
- /actuator/requestlog
- /actuator/accesslog
- /actuator/weblog
Correct answer: /actuator/httptrace
The /actuator/httptrace endpoint (renamed to /actuator/httpexchanges in Spring Boot 3) shows recent HTTP request-response exchanges.
Question 4: How do you create a custom HealthIndicator in Spring Boot?
- Implement the HealthIndicator interface and register it as a Spring bean (Correct answer)
- Extend AbstractHealthCheck and annotate with @HealthProbe
- Add a @Health annotation to any @Component class
- Call HealthRegistry.register() in @PostConstruct
Correct answer: Implement the HealthIndicator interface and register it as a Spring bean
Implementing the HealthIndicator interface and registering the class as a Spring bean automatically adds it to the /health endpoint.
Question 5: Which Micrometer metric type is best for measuring the duration of a database query?
- Timer (Correct answer)
- Gauge
- Counter
- DistributionSummary
Correct answer: Timer
A Timer measures both the count and total time of short-duration events like database queries.
Question 6: What does the /actuator/conditions endpoint show?
- Auto-configuration conditions that were evaluated and whether they matched (Correct answer)
- Currently active Spring profiles and their conditions
- Bean dependency conditions for circular reference detection
- Feature flags and their enabled/disabled conditions
Correct answer: Auto-configuration conditions that were evaluated and whether they matched
The /actuator/conditions endpoint reports all auto-configuration candidates and explains why each was applied or skipped.
Question 7: Which property changes the base path for all Actuator endpoints from /actuator to a custom path?
- management.endpoints.web.base-path (Correct answer)
- management.server.base-path
- actuator.base-path
- management.context-path
Correct answer: management.endpoints.web.base-path
management.endpoints.web.base-path customizes the root path under which all Actuator endpoints are served.
Which Spring Boot Actuator endpoint returns a live application status suitable for Kubernetes liveness probes?