Course contentsShow
← Cloud and Infrastructure
Lesson 1950 of 2,98942. Observability - MetricsFree lesson

Metric Types: Gauge

Using gauges for values that can go up and down, like memory usage, temperature, or concurrent requests.

Metric Types: Gauge

You'll learn how gauges track values that naturally fluctuate up and down, making them perfect for measuring current state rather than accumulated totals.

What Is a Gauge?

A gauge is a Prometheus metric type that represents a single numerical value that can arbitrarily go up or down over time. Unlike counters (which only increase), gauges are snapshots of the current state at any given moment.

Think of a gauge like a thermometer or fuel gauge in your car—the reading changes based on current conditions, and it makes perfect sense for it to go up, down, or stay the same.

When to Use Gauges

Gauges are ideal for metrics that represent current values rather than cumulative counts:

  • Memory usage: Current RAM consumption (can increase or decrease)
  • Temperature: CPU or system temperature readings
  • Concurrent requests: Number of active HTTP connections right now
  • Queue depth: Current number of items waiting to be processed
  • Disk space available: Free storage that fluctuates
  • Active pods/containers: Current count in your cluster

Gauge vs Counter

The key distinction: Counters measure "how many times has X happened?" while gauges answer "what is the current value of X right now?"

If you're monitoring the total number of requests processed, use a counter. If you're tracking how many requests are being handled at this moment, use a gauge.

Example Metrics

  • node_memory_available_bytes — available memory (gauge)
  • container_cpu_usage_seconds_total — CPU time used (counter)
  • kubelet_running_pods — currently running pods (gauge)

Key Takeaway: Gauges capture point-in-time values that naturally fluctuate, representing the current state of a system rather than cumulative totals—use them for anything where both increases and decreases are meaningful.