A Metric per Request
Easy · system design problem
The API pushes one metric sample per request to Prometheus. A spike quadruples traffic, Prometheus saturates — and the pushes fail the requests.
api pushes a metric sample to Prometheus (remote write, 100,000 samples/s) synchronously on every request. At T+20s a sale quadruples traffic for the rest of the day. Counters must stay exact — sampling them would lie — and Prometheus cannot be scaled or sharded today. A metrics collector can count in memory and write one aggregated sample per series per scrape interval.
Topics
More
Codelays runs in your browser: turn on JavaScript to use it.