intermediateMonitoring: Logs, Metrics, Prometheus & Grafana
How does Spring Boot expose metrics for Prometheus to scrape?
By adding the micrometer-registry-prometheus dependency and enabling the prometheus actuator endpoint (management.endpoints.web.exposure.include=prometheus), Spring Boot exposes JVM, HTTP request, and any custom Micrometer metrics in Prometheus's text exposition format at /actuator/prometheus, ready for a Prometheus scrape_config target.
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response