A Spring Boot application capturing metrics using Micrometer. Prometheus scrapes and stores the metrics whilst reporting is done in Grafana.
Prometheus scrapes the metrics using a HTTP call and therefore needs access to the running application. An easy way to achieve this, is to run the Spring Boot application in a Docker container too.
We therefore build a Docker image using jib and start it using Docker Compose.
./gradlew jibDockerBuild
docker-compose up -d
The example is accessible on:
- Spring Boot: http://localhost:8080
- Grafana: http://localhost:3000
- User: admin
- Password: admin
- Prometheus: http://localhost:9090
The Prometheus data source and a JVM dashboard are automatically provisioned in Grafana.