- Create Spring Boot initiazer (https://start.spring.io/) project from Spring with Spring MVC and Actuator
- Add dependency for micrometer
- Enable prometheus properties
- Add @Timed annotation around your API
- Once you start application you can see the metrices available at http://localhost:8091/actuator/prometheus
- On the Prometheus server side, each target is scraped at a regular interval(scrape interval). Each scrape reads the metrics to get the current state of the client metrics, and persists the values in the Prometheus time-series database
docker-compose up This will start 4 spring boot services, Prometheus and Grafana and then you can see metrices against call made to API are available in grafana.
References: