Prometheus Metrics

Once you have configured Prometheus with a list of targets, it can start retrieving metrics. There are four metric types available for Prometheus to store: counters, gauges, histograms, and summaries. These metric types fulfill the needs or requirements for most use cases and are found in the Prometheus client libraries which include Go, Java, Ruby, and Python.


Prometheus counters metrics are used for tracking the number of requests, error counts, or completed tasks. As such, counters never decrease and continually increase values (i.e., monotonically increasing values) which get exposed as time series. This is by design and requires that the client has to restart to reset the counters. Counters are also helpful when understanding how fast a value is rising.


Gauge metrics are point-in-time metrics that can increase and decrease. Since these metrics can go up or down, you do not use gauge metrics to generate a rate (use the counter metric instead). Gauge metrics are suitable for measuring current memory use, the number of items in a queue (queue size), number of requests in progress, or concurrent requests.


The Histogram metric is suitable for aggregated measures that calculate averages or percentiles, including request durations, response sizes, and Apdex scores that measure application performance. Histograms are sampled observations you determine in advance by using default definitions in a histogram bucket or your custom value.


The Summary metric is suitable for accurate quartiles. A summary samples observations, provides a total count of observations and a sum of observed values, and calculates quartiles. Summaries should be used for multiple measurements of a single value, allowing for calculating averages or percentiles. Typical use cases for summaries include request duration and response size.

The difference between Prometheus metrics and InfluxDB metrics

In general, one of the critical differences between Prometheus Metrics and InfluxDB Metrics is the collection mechanism. Prometheus Metrics are collected by scraping endpoints, while InfluxDB Metrics are collected by pushing metrics to an InfluxDB endpoint. However, InfluxDB has a set of Scrapers that will allow you to also pull metrics in the Prometheus-formatted metrics from HTTP-accessible endpoints and store them in InfluxDB.

Another difference between Prometheus metrics and InfluxDB metrics is that Prometheus collects and stores summaries of time series data while InfluxDB collects each data point. Both have their merits, and choosing either should depend on your use case. If you need high-resolution data, InfluxDB can collect, store, and process this data efficiently. But if summarized data is sufficient for your use case, Prometheus may work best for you.

Related resources