metric-types icon indicating copy to clipboard operation
metric-types copied to clipboard

Accompanying repo to tutorial video where you’ll discover what are the 4 different types of Prometheus metrics, how to decide which one is right for a specific scenario, and how to query them.

CI

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.

Pre-requisites

  • JDK 17+
  • Docker (unless you just want to run the application without Prometheus)

Running

./gradlew build docker dockerComposeUp

Stopping

./gradlew dockerComposeDown

Need further support?

Contact me if you need help at [email protected].