This is a sample for monitoring spring boot web application by using Prometheus and Grafana.
You must intall docker, and use docker-compose command.
Run application as follows.
$ git clone https://github.com/aha-oretama/spring-boot-prometheus-grafana-sample.git
$ cd spring-boot-prometheus-grafana-sample
$ docker-compose up -d
Three applications are going to start. (Spring boot web application takes a little time to start up.)
Application | URL |
---|---|
spring boot web application | http://localhost:8080 |
Prometheus | http://localhost:9090 |
Grafana | http://localhost:3000 |
Prometheus monitors spring boot application. Grafana visualizes prometheus data source.
You can login to Grafana by admin/admin
.
You set up prometheus data source as follows.
item | value |
---|---|
Type | Prometheus |
URL | http://localhost:9090 |
Access | direct |
Scrap interval | 5s |
I don't explain here. Refer to Prometheus documenatation and Grafana documentation.
item | value |
---|---|
/prometheus |
Display metrics for prometheus. |
/hello |
Return hello . The durations of process are collected as metrics named hello_controller_say_hello_duration_seconds_count ,hello_controller_say_hello_duration_seconds_sum . |
/count |
Return count of requests. The count of request is collected as metrics named count_requests_total . |