Prometheus Metrics
In the modern DevOps world, Prometheus format metrics have become a standard used for monitoring applications and scaling them.
Let me remind you that architecturally, Prometheus uses a pull model to gather data, meaning the server itself queries specified points for metrics at a set interval. These points are commonly referred to as exporters. There are a multitude of ready-made exporters for all sorts of use cases.
For example, if we want to monitor Redis for queue length, which should not exceed a set threshold, we can run a Redis exporter that acts as a bridge between Prometheus and the Redis server. In its settings, we specify the query we need.
Applications can, of course, have built-in metrics, in which case an intermediate exporter is not required.
Prometheus defines four main types of metrics:
-
Counter: A counter is a simple numeric metric that only increases or resets to zero on restart. Examples of counters include the number of HTTP server requests, the number of tasks completed, etc.
-
Gauge: This metric represents a single numeric value that can increase or decrease arbitrarily. Examples include current memory usage, the number of concurrent threads running, etc.
-
Histogram: A histogram is a metric that collects observed values in the form of buckets (groups of values within a certain range) and also provides a counter of accumulated observations and the sum of all observed values. Examples include measuring response time, request size, etc.
-
Summary: A summary is similar to a histogram but also provides the ability to calculate quantiles of observed values.