Trying out Prometheus, an open-source monitoring solution; and Grafana, an open-source metrics visualization tool.
This project was heavily influenced by AlphaHydrae prometheus-experiments although there are significant differences in the techonology stack, and approach.
This demo will:
- Run an instance of Prometheus (exposed on port 9090)
- Run a Grafana instance (exposed on port 3000) and configure Prometheus datasource
- Run a spring-boot based HTTP API instrumented with Micrometer exposing metrics in Prometheus expected format
- Run a dummy client to run a GET request to the API each second
Use init.sh script to build and run the entire stack. Note this could take some time.
- Visit http://localhost:3000 to see Grafana (log in with username
admin
and passwordadmin
) - Visit http://localhost:9090 to see the Prometheus backend
- Visit http://localhost:8080/actuator/prometheus to see the Prometheus formatted metrics.
Use stop.sh to down and clean all elements from the stack
This project has been developed with the only purpose of providing an environment where to experiment with Grafana and Prometheus.
HTTP API was developed with spring-boot 2.0 including actuator dependency
Micrometer metrics has been configured to expose Histogram type metrics to prometheus measuring latency on /api/people endpoint.
/api/people endpoint does nothing but sleep a random amount of time between 100 and 1000 ms and return the number of ms the thread as slept.