Skip to main content
Prometheus scrapes instrumented targets and reads metrics in the OpenMetrics plain-text format: metric name, optional labels, and a numeric value. For example:
What do the numeric values mean? When Prometheus scrapes a target and sees 10 for an HTTP request metric or a large number for memory usage, is that a snapshot or a cumulative counter since the process started? Those are very different interpretations and change how you query and visualize metrics. Prometheus supports four metric types — counters, gauges, histograms, and summaries. This guide focuses on the two simplest and most common types: counters and gauges.

Counters

A counter is a monotonically increasing value. It typically starts at 0 when the instrumented process starts and increases until the process restarts (at which point it resets). Counters are used for values that accumulate over time, such as requests served or bytes transmitted. If a counter appears to decrease, it usually means the process restarted or the instrument was misused; Prometheus query functions are designed to handle these resets. Example counter observed at multiple scrapes:
Common use cases for counters:
  • Total HTTP requests served
  • Total errors returned
  • Total network bytes transmitted
A presentation slide titled "Counters Examples" with a central blue "Counter" icon and three rounded blue boxes listing example metrics: "01 | Total HTTP Requests Served", "02 | Total errors returned", and "03 | Total network bytes transmitted." The slide includes a small "© Copyright KodeKloud" notice in the corner.
The raw cumulative value of a counter is rarely what you want to chart directly. Instead, you typically want the rate of change (e.g., requests per second or errors per minute). Prometheus provides PromQL functions that compute rates and deltas from cumulative counters and correctly handle counter resets:
  • Per-second rate (instantaneous over range): rate(http_requests_total[5m])
  • Total increase in a time window: increase(http_requests_total[1h])
Example PromQL:
Counters are monotonic — they only increase (except when a process restarts). Use PromQL functions like rate() and increase() to convert cumulative counters into meaningful rates or deltas over time. These functions also handle counter resets for you.

Gauges

A gauge represents a value that can go up or down and is scraped as a snapshot at the time of collection. Gauges are ideal for current-state measurements such as memory usage, the number of running processes, or queue depth. Client libraries typically expose operations to set a gauge to a specific value or to increment/decrement it. Example gauge:
Gauges are suitable when the instantaneous value is meaningful rather than an accumulated total.

Counters vs. Gauges — Quick reference

When counters and gauges are not enough

Counters and gauges cover many scenarios, but they do not capture distributions (for example, the spread of request latencies across many requests). To observe distributions and percentiles you should use histograms or summaries:
  • Histograms expose bucketed counts, plus a sum and count, allowing you to compute percentiles and bucketed distributions server-side.
  • Summaries expose client-side calculated quantiles along with a sum and count.
These are better suited for latency and size distributions.
A presentation slide titled "Next Up: Histograms (and Summaries)" showing an "Application Latency Histogram" with colored bars across latency buckets. The chart has tall green bars around the 50–250ms range and smaller orange/red bars around the 2.5–10s range.
Histograms and summaries let you capture and query distributions such as request latency across many requests.

Watch Video