See how your Spring Boot app connects to Prometheus and Grafana. This is a bonus demo for the Expense Tracker workshop — showing DevOps engineers the bridge between the app they built and the monitoring they already know.
| Component | Port | URL |
|---|---|---|
| Spring Boot App | 8080 | http://localhost:8080/swagger-ui.html |
| Actuator Metrics | 8080 | http://localhost:8080/actuator/prometheus |
| Prometheus | 9090 | http://localhost:9090 |
| Grafana | 3000 | http://localhost:3000 (admin/admin) |
1. Start Prometheus + Grafana:
docker compose up -d2. Start the Spring Boot app:
cd app
./mvnw spring-boot:run3. Open the dashboards:
- Grafana: http://localhost:3000 (login: admin / admin)
- The "Expense Tracker" dashboard is pre-configured
4. Generate some traffic:
Open Swagger UI at http://localhost:8080/swagger-ui.html and:
- Add a few expenses (POST /expenses)
- List them (GET /expenses)
- Delete some (DELETE /expenses/{id})
Watch the Grafana dashboard update in real time!
| Endpoint | What it shows |
|---|---|
/actuator/health |
App health status (UP/DOWN) |
/actuator/info |
App info |
/actuator/prometheus |
All metrics in Prometheus format |
/actuator/metrics |
List of available metric names |
| Panel | What it shows |
|---|---|
| HTTP Request Rate | Requests per second by endpoint |
| Response Time (p95) | 95th percentile response time |
| Expenses Added | Counter of POST operations |
| Expenses Deleted | Counter of DELETE operations |
| JVM Heap Memory | Memory usage over time |
| JVM Threads | Number of live threads |
| GC Pause Time | Garbage collection impact |
| CPU Usage | Process CPU utilization |
| Uptime | How long the app has been running |
The app exposes custom Micrometer counters:
expenses_added_total — number of expenses created
expenses_deleted_total — number of expenses deleted
These are defined in ExpenseController.kt using Counter.builder().
Browser/Swagger UI
│
▼
Spring Boot App (:8080)
├── /expenses — REST API
└── /actuator/prometheus — metrics endpoint
│
▼ (scrapes every 5s)
Prometheus (:9090)
│
▼ (queries)
Grafana (:3000)
└── Dashboard: Expense Tracker
- Spring Boot Actuator exposes metrics at
/actuator/prometheus - Micrometer collects JVM, HTTP, and custom metrics
- Prometheus scrapes the endpoint every 5 seconds
- Grafana queries Prometheus and visualizes the data
| File | Purpose |
|---|---|
app/pom.xml |
spring-boot-starter-actuator + micrometer-registry-prometheus |
app/src/.../application.yaml |
Actuator endpoint exposure config |
app/src/.../ExpenseController.kt |
Custom Micrometer counters |
docker-compose.yml |
Prometheus + Grafana containers |
prometheus/prometheus.yml |
Scrape config targeting localhost:8080 |
grafana/dashboards/expense-tracker.json |
Pre-built Grafana dashboard |
docker compose down- expense-tracker-spring — Workshop Session 1
- expense-tracker-frontend — React frontend
- expense-tracker-workshop-02 — Workshop Session 2