Skip to content

Commit 862937f

Browse files
authored
Merge pull request #38 from mszarlinski/metrics-dashboard
Metrics dashboard
2 parents 3fa4433 + 8752a02 commit 862937f

File tree

23 files changed

+3550
-79
lines changed

23 files changed

+3550
-79
lines changed

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ a look:
704704
}
705705
```
706706
- As you could see above, we also try not to use component scan wherever possible. Instead we utilize
707-
`@Configuration` classes where we define module specific beans in the infrastracture layer. Those
707+
`@Configuration` classes where we define module specific beans in the infrastructure layer. Those
708708
configuration classes are explicitly declared in the main application class.
709709
710710
### Tests
@@ -794,6 +794,22 @@ Either way once built you can run it like so:
794794
$ docker run -ti --rm --name spring-library -p 8080:8080 spring/library
795795
```
796796

797+
### Production ready metrics and visualization
798+
To run the application as well as Prometheus and Grafana dashboard for visualizing metrics you can run all services:
799+
800+
```console
801+
$ docker-compose up
802+
```
803+
804+
If everything goes well, you can access the following services at given location:
805+
* http://localhost:8080/actuator/prometheus - published Micrometer metrics
806+
* http://localhost:9090 - Prometheus dashboard
807+
* http://localhost:3000 - Grafana dashboard
808+
809+
In order to see some metrics, you must create a dashboard. Go to `Create` -> `Import` and select attached `jvm-micrometer_rev8.json`. File has been pulled from
810+
`https://grafana.com/grafana/dashboards/4701`.
811+
812+
Please note application will be run with `local` Spring profile to setup some initial data.
797813

798814
## References
799815

docker-compose.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
version: "3"
2+
services:
3+
app:
4+
image: spring/library:latest
5+
container_name: 'library'
6+
build:
7+
context: ./
8+
dockerfile: Dockerfile
9+
environment:
10+
- "SPRING_PROFILES_ACTIVE=local"
11+
ports:
12+
- '8080:8080'
13+
14+
prometheus:
15+
image: prom/prometheus:v2.4.3
16+
container_name: 'prometheus'
17+
volumes:
18+
- ./monitoring/prometheus:/etc/prometheus/
19+
ports:
20+
- '9090:9090'
21+
22+
grafana:
23+
image: grafana/grafana:5.2.4
24+
container_name: 'grafana'
25+
ports:
26+
- '3000:3000'
27+
volumes:
28+
- ./monitoring/grafana/provisioning/:/etc/grafana/provisioning/
29+
env_file:
30+
- ./monitoring/grafana/config.monitoring
31+
depends_on:
32+
- prometheus
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
GF_SECURITY_ADMIN_PASSWORD=password
2+
GF_USERS_ALLOW_SIGN_UP=false

0 commit comments

Comments
 (0)