Repository to accompany The Four Types Of Prometheus Metrics (YouTube video | article).
It contains an application that has 4 controllers to simulate the 4 different types of Prometheus metric:
- Counter - hit /hello to increment the request_count counter
- Gauge - hit /push to increment the queue_size gauge and /pop to decrement it
- Histogram - hit /wait to record the response time in the
request_duration
histogram - Gauge - hit /waitSummary to record the response time in the
request_duration_summary
summary
All metrics are exposed at /actuator/prometheus.
This repository also contains a configuration for Prometheus, which scrapes the application. Both the application and Prometheus are brought up using Docker Compose.
- JDK 17+
- Docker (unless you just want to run the application without Prometheus)
./gradlew build docker dockerComposeUp
- application runs at localhost:8080
- Prometheus runs at localhost:9090
./gradlew dockerComposeDown
Contact me if you need help at tom@tomgregory.com.