Actuator cung cấp endpoint production-ready expose thông tin app qua HTTP/JMX — không cần viết code monitoring. Thêm starter spring-boot-starter-actuator, chọn endpoint expose qua management.endpoints.web.exposure.include: health, metrics, info, prometheus.
Endpoint chính:
- /actuator/health — liveness/readiness probe (Kubernetes).
- /actuator/metrics — CPU, memory, HTTP latency.
- /actuator/prometheus — format cho Prometheus scrape.
- /actuator/info — build info, git commit.
- /actuator/loggers — đổi log level runtime, không restart.
Dùng cho: operational visibility, debug production, health check K8s, monitoring Prometheus + Grafana. Bảo mật: endpoint nhạy cảm (/env, /heapdump) phải chặn qua Spring Security hoặc chỉ mở trên port nội bộ (xem câu bảo vệ Actuator).