RED, USE & Prometheus Fundamentals

Rate, Errors, Duration for services; Utilization, Saturation, Errors for resources; counter vs gauge vs histogram; PromQL basics and scrape/pull model.

3/5Overview: 30m

RED for services, USE for resources

RED (Weaveworks) — microservice health:

SignalMetricExample
RateRequests per secondhttp_requests_total counter
ErrorsFailed requests / totalrate(http_requests_total{status=~"5.."})
DurationLatency distributionhttp_request_duration_seconds histogram

USE (Brendan Gregg) — resource health:

SignalMeaning
Utilization% time busy (CPU, disk bandwidth)
SaturationQueue depth, threads waiting
ErrorsDevice/controller errors

Use RED on your API; USE on databases, nodes, and thread pools. Google SRE's four golden signals overlap: latency ≈ Duration, traffic ≈ Rate, errors ≈ Errors, saturation ≈ Saturation.

Prometheus metric types

TypeBehaviorExample
CounterMonotonic, only increasesrequests_total, errors_total
GaugeUp and downqueue_depth, memory_bytes
HistogramObservations in buckets + _sum, _countrequest_duration_seconds
SummaryClient-side quantiles (avoid in most cases)Legacy — prefer histograms

Counter rule: use rate() or increase() — never graph raw counter values.

PromQL essentials

# Error rate (5xx per second) sum(rate(http_requests_total{status=~"5.."}[5m])) / sum(rate(http_requests_total[5m])) # p99 latency (histogram) histogram_quantile(0.99, sum(rate(http_request_duration_seconds_bucket[5m])) by (le))

Interviewers want: correct rate() window, label aggregation with sum() by (...), knowing histogram quantiles are estimated.

Pull vs push

Prometheus pulls from /metrics endpoints on a scrape interval. Benefits: service discovery, up/down detection, no agent buffering logic in app.

Push gateways exist for batch jobs (short-lived processes) — not for long-running services.

Label discipline

Good labels: method, status, service, deployment (bounded enums).

Bad labels: user_id, url (with path params), trace_id.

Cardinality explosion is the #1 Prometheus outage cause at scale.

What OS track covers

iostat, disk await, page faults — resource metrics at the kernel level. This topic instruments your service's request path.

Interview answer

"Every RPC handler exports RED. Node exporters give USE for capacity planning. Alerts fire on SLO burn (see SLOs topic), not raw CPU. Histograms for latency — never averages alone."

Link forward

Histograms, Percentiles & SLIs explains bucket design and why histogram_quantile lies at extreme tails.

Further Reading

Hands-On Tasks (Optional)

Low-setup exercises — signal-selection drills, local Prometheus/Grafana, or OTel sandbox. No autograding; the goal is production triage fluency.

  • Sketch RED metrics for an API

    Name the exact Prometheus metric names and types you'd expose for a REST checkout API (rate, error rate, duration). Note one label you'd avoid and why.

    15m