Hands On FullStack Development

Hands On FullStack Development

Week 4: Metrics Collection Platform

Jun 27, 2026
∙ Paid

🗄️ 52 FAANG Interview Question Vault — $299 one-time

All 52 walkthroughs + 52 drill cards + 6 framework cheatsheets + the Senior+ System Design Playbook. Everything, immediately. Lifetime access with all future updates included.

→ [VAULT CHECKOUT LINK]

What We Are Building

This lesson delivers a production-grade metrics collection and observability console for InfraWatch:

  1. Time-series schema — Raw points, retention policies, metric catalog, and pre-aggregated rollups

  2. Collection pipeline — Agent protocol, validation, batch ingestion, and scheduled collection

  3. Storage layer — PostgreSQL persistence with Redis hot-path cache and pub/sub streaming

  4. Aggregation engine — Sliding-window statistics, historical rollups, and trend detection

  5. Query API — Time-range queries with caching, CSV/JSON export, and summary endpoints

  6. Observability console — Datadog-style dashboard with live charts and agent status


Core Concept: Write Path vs Read Path

Production metrics systems split into two lanes. The write path accepts high-volume, fire-and-forget data points from agents—validate, index, persist, and push to a hot cache in milliseconds. The read path serves dashboards and alerts—query pre-aggregated buckets first, fall back to raw data only when needed, and cache results by time range.

The insight most tutorials skip: retention is a write-time decision, not a cleanup cron job. When a point lands, the system already knows its tier (realtime, recent, daily) and expiry date based on metric name patterns. Datadog and Grafana Cloud use this pattern—policy resolution at ingest keeps query performance predictable as volume grows.


Where This Fits in the Overall System

Server Fleet Management        inventory spine — agents attach here
        │
Metrics Collection             ◀ this lesson
        │
Alert Management               rules evaluate against stored series
        │
Notification System            delivers when thresholds breach

You are building the telemetry pipeline that turns raw host signals into queryable time-series. Every alert rule and capacity plan downstream assumes this layer exists and returns data within SLA.


Component Architecture

Agents — Lightweight collectors (psutil-based) push validated batches over WebSocket every five seconds.

Ingestion — Validator rejects out-of-range values; ingester dual-writes to PostgreSQL and Redis; catalog index updates on every point.

Aggregation — Background collector plus sliding-window engine compute avg/min/max/p95; rollups compress raw data into 1m/5m/1h buckets.

Query API — FastAPI serves cached queries, exports, summaries, and SSE streams for live dashboards.

Console — Dark-theme React UI polls REST every five seconds and receives WebSocket push on new points.

User's avatar

Continue reading this post for free, courtesy of System Design Roadmap.

Or purchase a paid subscription.
© 2026 System Design Roadmap · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture