Repair an error ratio and distinguish zero failures from missing data.

Instruction: Calculate the weighted result, repair the query, and define the displayed state for healthy traffic, zero traffic and incomplete collection.

Context:

A fictional http_requests_total counter has job="api", service, instance and status labels. Every eligible request increments exactly one status series; 5xx is bad. Counters can reset. The current dashboard averages per-instance ratios.

InstanceTotal requests/sBad requests/s
A1001
B11

Instrumentation contract: every expected instance initializes its status-200 series at zero; other status series appear only when used. A successful scrape exposes all of that target's counters. Scrapes occur every 60 seconds. A trustworthy independent control plane exports one service_target_expected{service,instance}=1 per expected target; that inventory is stable throughout this five-minute exercise. The report covers this named expected fleet; unexpected targets must be investigated separately as inventory drift.

For a complete window, every expected target needs a fresh current up=1 sample no older than 75 seconds, exactly five successful scrape samples in the five-minute range, and five status-200 counter samples. Treat missing inventory as unknown. This deliberately strict exercise policy does not assume that a real collector or exporter is infallible.

Updated

Official answer available

Read the opening below, then unlock the full answer and practical guidance.

The weighted bad fraction is 2/101, about 1.98%, rather than 50.5%. I would calculate each counter's rate before summing...

Related Questions