Pcornel
Browse topics
Options
Recent
Favorites
Observability · Technical reference

Metrics

Direct answer

Metrics are numeric time series identified by a name and labels, sampled or aggregated over time — cheap to store and ideal for trends, dashboards and alerts.

When to use this

Use it to measure rates, latencies, saturation and resource usage.

First 30 seconds

1. List series for a metric: count by (__name__)({__name__=~"http_.*"}).

2. Counter? use rate(metric[5m]).

3. Latency via histogram quantiles.

4. Check label cardinality.

5. Graph and compare with expectations.

Operational verification

code/exporter exposes metric → scraped/pushed → TSDB → query → dashboard/alert

Evidence · next step

Typical mistakes are taking a raw counter as a rate, averaging ratios incorrectly, resetting counters across restarts, using unbounded labels, aggregating away instance errors and interpreting missing data as zero without checking scrape state. Preserve the first divergent observation and repeat the same bounded verification after remediation.

Continue only after interpreting the current observation.
Context & applicabilityCommon mistakes · platform/version boundaries
Common mistakes
What not to infer

Observability owns metric semantics and query/collection behavior. The producing Domain owns what the underlying system state means.

Platform / version applicability
OpenTelemetry / Prometheus / Grafana / common metrics-log-trace pipelines
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformOpenTelemetry / Prometheus / Grafana / common metrics-log-trace pipelines · Observability owns metric semantics and query/collection behavior. The producing Domain owns what the underlying system state means.
Scope / prerequisiteUse it to measure rates, latencies, saturation and resource usage.
What next?3 suggested next steps
Child topics (this level)4
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

2 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Verification workflow Verify boundary

Confirm metric type, unit, label set and scrape/collection interval before writing a query. For counters use rate/increase over an appropriate window; for distributions preserve bucket/quantile semantics. Compare raw series with aggregated dashboard values when diagnosing a narrow failure.

Step 2 Failure signatures and limits Narrow the fault

Typical mistakes are taking a raw counter as a rate, averaging ratios incorrectly, resetting counters across restarts, using unbounded labels, aggregating away instance errors and interpreting missing data as zero without checking scrape state.

Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

test · 1
Drill down

Subtopics

Go one level deeper into this subject.

Key points

Pick the right type (counter, gauge, histogram). Apply rate() to counters. Keep label cardinality bounded — never put user IDs or URLs with IDs into labels.

Key checks
  • count by (__name__)({__name__=~"http_.*"}) — first check for this topic
  • curl -s localhost:9090/-/ready — Prometheus ready
  • curl -s 'localhost:9090/api/v1/query?query=up' — scrape targets up/down
  • promtool check config prometheus.yml — config valid
ReferenceWhat it is1 section · depth on demand

Operating model

Metrics are numeric time-series observations. Counters accumulate events, gauges represent values that can rise/fall, and histogram/summary structures describe distributions with different aggregation trade-offs. Labels make series useful but create a multiplicative cardinality cost.

ReferenceHow it works1 section · depth on demand

In depth

Metrics are numeric measurements collected over time — CPU usage, request rate, error count, latency percentiles, interface throughput. They are cheap to store, fast to query and the basis for dashboards and alerting.

Metric typeExample
CounterTotal requests, bytes sent (only increases; use rate)
GaugeCurrent memory, queue length, temperature
HistogramRequest durations in buckets → percentiles
SummaryPre-computed quantiles

Useful frameworks for choosing metrics:

MethodMetrics
RED (services)Rate, Errors, Duration
USE (resources)Utilisation, Saturation, Errors
Four golden signalsLatency, traffic, errors, saturation

Watch cardinality: every unique label combination is a separate time series, so labels like user ID or full URL can overwhelm the metrics system.

ReferenceImportant terms & boundaries1 section · depth on demand

Scope map

  • Counters
  • Gauges
  • Histograms
  • Summaries
  • Labels
  • Rate/increase
  • Aggregation
  • Time-series concepts
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical examples

Configuration & expected output

Concrete examples are shown only when the stored reference contains an actual configuration or output shape for this Topic.

Configuration example

Prometheus Prometheus 2.45 or laterRequest rate and error ratio from a counter.

Assumptions: The service exposes http_requests_total with a code label.

# recording rules
groups:
- name: http
  rules:
  - record: job:http_requests:rate5m
    expr: sum by (job) (rate(http_requests_total[5m]))
  - record: job:http_errors:ratio5m
    expr: sum by (job) (rate(http_requests_total{code=~"5.."}[5m])) / sum by (job) (rate(http_requests_total[5m]))

Expected output

Prometheus Prometheus 2.45 or laterpromtool query instant http://prometheus:9090 'job:http_errors:ratio5m{job="checkout"}'

Expected state: The error ratio is a small fraction between 0 and 1.

job:http_errors:ratio5m{job="checkout"} => 0.0021 @[1761379200]
Always apply rate() to counters; the raw counter only grows and resets on restart. Illustrative authored output: field layout matches the tool, values will differ in your environment.
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-29 · otherOpenTelemetry / Prometheus / Grafana ecosystem OpenTelemetry current specification

Documentation verification: confirms the upstream model used by the Topic. It does not assert local production behavior.

Basis: https://opentelemetry.io/docs/specs/otel/metrics/ · confidence 92%
Technical changelog & impact

What changed and what may be affected

Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.

Related reference impactReview these references after material technical changes when their shared boundary is affected.
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
metricsmetrics observabilityPrometheus metric typescounter gauge histogram
Embedded reference data

Quick lookup tables

Metrics verification boundary matrix

A compact lookup separating intent, owning component state, effective state and consumer-visible outcome for Metrics.

BoundaryInspectHealthy interpretationDo not infer
IntentCountersIntended object/scope is explicit and versioned where relevantIntent is already effective
Owning runtime/control planeGauges / HistogramsOwner accepts and reports the expected object stateDownstream dependencies are healthy
Effective stateSummariesIndependent read-back matches the intended stateEvery client sees the same result
Consumer outcomeLabelsThe original bounded check succeeds in the same time windowProduction correctness outside this scope
Depth when you need it

Deep reference

Design & tradeoffs

Scope

Observability owns metric semantics and query/collection behavior. The producing Domain owns what the underlying system state means.

Confirmation

Confirm action

Continue?