liveBook · Manning

Gauge

As explained in Learn Docker in a Month of Lunches, Second Edition

A gauge is a metric whose value can increase or decrease to represent a current level or quantity.

A gauge is a numeric metric for a value that can rise or fall, such as active requests, current memory use, or another changing quantity. Your application or its developers choose when to update it; Prometheus and the client library handle collection. section 9.2 section 9.4

Use a gauge when the metric represents a current level rather than an accumulated total:

  • Declare a gauge with a descriptive name and help text. section 9.2
  • Set its value when the application observes the current quantity. section 9.2
  • Expose the application’s /metrics endpoint and inspect the collected value. section 9.2
  • Query and visualize the gauge to follow operational trends; sudden changes matter more than an isolated value. section 9.4

Tracking current unique IP addresses

A Node.js application can declare an access_client_ip_current gauge and update it with the current count: clientIpGauge.set(countOfIpAddresses). This differs from an access_log_total counter, which only increases. section 9.2

Figure 9.13 A closer look at the application dashboard and how visualizations relate to the golden signals
figure

Inspect how a Grafana application dashboard connects gauge visualizations with operational signals such as in-flight requests. section 9.4

How Learn Docker in a Month of Lunches, Second Edition covers it

How deep it goes
Defines increasing and decreasing values, demonstrates declaration and updates, and stops short of advanced metric types and complex PromQL.
Examples
Demonstrates current unique IP addresses and in-flight HTTP requests as gauge values.
What it assumes
Assumes an application and a Prometheus client library, while demonstrating gauge usage across Node.js, Go, and Java.
What you can do after
Build it from scratch by declaring, updating, exposing, querying, and visualizing a gauge in a containerized application.
How it connects
Connects gauges with Prometheus, client libraries, counters, /metrics endpoints, PromQL, and Grafana.

Also explained in

Compare how 2 books explain gauge →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Docker in a Month of Lunches, Second Edition. The section links point to the parts of the book it draws on.