liveBook · Manning

Resource tag

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

A metric label is a named metadata field attached to a metric value to distinguish dimensions of the measured data.

A resource tag is a named metadata field attached to a metric value. In Prometheus, labels distinguish otherwise similar measurements, such as the hostname of each container producing access-log metrics. section 9.3

Use resource tags to inspect and compare distributed workloads:

  • Scale the access-log service to three containers and send requests to the application. section 9.3
  • Open the Prometheus UI and query access_log_total to see one metric value per container. section 9.3
  • Compare the tagged values to evaluate how evenly requests are load-balanced. section 9.3

Aggregate across resources

When individual container tags are not needed, sum the metric while excluding hostname and instance: sum(access_log_total) without(hostname, instance). The result combines values across containers and can be graphed over time. section 9.3

sum(access_log_total) without(hostname, instance)

Inspect the PromQL aggregation that removes per-resource distinctions and produces a combined metric. section 9.3

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

How deep it goes
Explains labels through a worked Prometheus workflow and aggregation query, without detailing label creation or storage internals.
Examples
Demonstrates hostname labels on three scaled containers and aggregates access_log_total while excluding hostname and instance.
What it assumes
Assumes basic Docker scaling and Prometheus UI access while demonstrating labels through container metrics.
What you can do after
Diagnose load distribution with labeled Prometheus metrics and aggregate values across containers.
How it connects
Connects metric labels with Prometheus, load balancing, aggregation, and PromQL.

Also explained in

Compare how 6 books explain resource tag →

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.