Free — no signup required

The Power of Labels

1 min read

Slicing and Dicing Data

A single metric name like http_requests_total isn't very useful on its own. It doesn't tell you which requests are failing or which endpoint is getting hammered.

Labels (also called tags or dimensions in other systems) are key-value pairs attached to a metric that provide context and allow you to filter and group data.

Instead of tracking one big number, you track many smaller numbers across different dimensions simultaneously:

  • http_requests_total{method="POST", status="200", endpoint="/api/checkout"}
  • http_requests_total{method="GET", status="500", endpoint="/api/products"}
  • http_requests_total{method="GET", status="200", endpoint="/api/products"}

Each unique combination of label values creates a separate time-series in the database. This allows you to write powerful queries: the overall error rate across all endpoints, the error rate scoped to just one endpoint by adding a label filter, or error rates broken out per HTTP method by grouping on that label.

A well-designed label taxonomy — a consistent naming convention for your labels — is one of the most valuable investments a platform team can make. It determines how queryable and useful your metrics are across the entire organization.

This is one of 18 chapters

Every chapter is free — Kubernetes, Terraform, SRE, distributed systems, and more — with fast daily review built in.

Sign up free