Course contentsShow
← System Design
Lesson 1175 of 1,91930. Observability: MetricsFree lesson

Gauge Metrics

Learn gauges as point-in-time measurements that can increase or decrease, like memory usage or queue depth.

Gauge Metrics

You'll learn how gauge metrics capture instantaneous, fluctuating values in your system.

What is a Gauge?

A gauge is a metric type that represents a point-in-time measurement that can both increase and decrease. Unlike counters (which only go up), gauges reflect the current state of something right now.

Think of it like a thermometer or a car's fuel gauge—the value moves up and down naturally as conditions change. You're not accumulating anything; you're simply observing what the value is at this moment.

Common Use Cases

Gauges are ideal for tracking:

  • Memory usage (current bytes allocated)
  • CPU utilization (current percentage)
  • Queue depth (number of items waiting right now)
  • Active connections (current count)
  • Thread pool size (threads in use at this instant)
  • Database connection pool utilization

Each of these metrics naturally fluctuates. Your memory usage might be 2.3 GB now, 1.8 GB in five seconds, and 3.1 GB a minute later.

How Gauges Differ from Counters

Remember that counters only increment (like counting total HTTP requests). A gauge, however, reflects the current state:

  • Counter: "We've processed 10,000 requests total" (always increasing)
  • Gauge: "There are 47 active connections right now" (up and down)

When to Use Gauges

Use gauges when you need to answer "What is the value right now?" rather than "How many have occurred?" They're perfect for resource utilization, capacity planning, and understanding instantaneous system load.

Key Takeaway: Gauges measure values that naturally fluctuate over time, providing snapshots of your system's current state—like memory usage or queue depth—rather than cumulative totals.