Spring Boot Actuator with Prometheus and Grafana for Cloud Monitoring

Published on 4/11/2025 â€ĸ Categories: actuator, monitoring, prometheus, spring boot, grafana

Spring Boot Actuator with Prometheus and Grafana for Cloud Monitoring

Introduction

Spring Boot Actuator exposes app metrics. When paired with Prometheus and Grafana, you get full observability.

Architecture

Monitoring StackMonitoring Stack

Setup

  1. Add dependencies:
xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
  1. application.yml
yaml
management:
endpoints:
web:
exposure:
include: "*"
metrics:
export:
prometheus:
enabled: true
  1. Prometheus config:
yaml
scrape_configs:
- job_name: 'spring'
metrics_path: '/actuator/prometheus'
static_configs:
- targets: ['host.docker.internal:8080']

Dashboard Example

Grafana SampleGrafana Sample

Conclusion

You now have real-time app metrics ready for visualization!