Prometheus metrics
In the modern world of Devops, Prometheus-format metrics have already become a standard used for monitoring applications, as well as for scaling them.
As a reminder, architecturally Prometheus uses a pull model to obtain data, that is, the server itself requests metrics from the specified endpoints at a given interval. These endpoints are commonly called exporters. There's a great variety of ready-made exporters for all occasions.
For example, say we want to monitor redis for the queue length, which must not exceed a given threshold. To do this, you can run a redis exporter, which will be the link between prometheus and the redis server. And in its settings we specify the query we need.
Applications, of course, can also have built-in metrics, in which case an intermediate link is not required.
Prometheus defines four main metric types:
-
Counter: A counter is a simple numeric metric that only increases or is reset to zero on a restart. Examples of counters: the number of requests to an HTTP server, the number of completed tasks, and so on.
-
Gauge: This is a metric that represents a single numeric value that can arbitrarily go up or down. Examples: current memory usage, the number of concurrently running threads, and so on.
-
Histogram: A histogram is a metric that collects observed values into buckets (groups of values within a certain range) and also provides a count of accumulated observations and a sum of all observed values. Examples: measuring response time, request size, and so on.
-
Summary: A summary is similar to a histogram, but also provides the ability to calculate quantiles of the observed values.