
IoT Observability Pipeline
Event-driven IoT telemetry with real-time stream enrichment
📡 Context
Picture a large building 🏢 with hundreds of rooms, each full of sensors: cameras 📷 capturing frames and ambient-light sensors 💡 reporting the current lighting. Every device speaks on its own schedule, and on its own.
This project is an event-driven pipeline that ingests all of those readings, correlates them in real time — matching each camera frame with the latest light reading for its room — and publishes a single enriched stream ready for analytics 📊, dashboards, or alerting.
The system simulates a realistic load: 100 rooms × 5 cameras = 500 devices producing telemetry concurrently.
🔀 Explanation
🌟 High-Level Flow (Non-Technical)
- 📥 Trigger — A single HTTP call kicks off a full round of device readings.
- 📦 Fan-out — The workload is split into 500 independent tasks, one per camera, and run in parallel.
- 📨 Publish — Each task emits its reading (a camera frame or a light-color update) as an event onto a streaming backbone.
- 🧠 Correlate — A stateful consumer remembers the latest light color for every room and attaches it to each incoming frame.
- ✅ Enriched output — The combined frame-plus-context payload is published to a final stream for downstream consumers.
🧱 Architecture
FastAPI
— Thin HTTP layer exposing the
POST /triggerendpoint.Celery + Redis
— Distributed task queue;
group()dispatches 500 camera tasks in parallel.Apache Kafka
— Event backbone: two input topics (
device.state,device.frames) and one output topic (enriched.telemetry.output).Stream Enricher
— Stateful consumer holding a per-room light map in memory and correlating frames as they arrive.
Docker Compose
— Orchestrates every service for a one-command local run.
Technologies
🐍 Python 3.11
- FastAPI trigger API ⚡
- Celery distributed task queue
kafka-pythonproducers and consumer
📨 Apache Kafka
- Event streaming backbone
- Two input topics + one enriched output topic
- Replayable, decoupled stages
🧵 Celery + Redis
group()fan-out across 500 camera tasks- Redis as the message broker
🐳 Docker Compose
- FastAPI, Celery, Kafka, and Redis in one stack
docker-compose up --buildto run it all
🧪 pytest + coverage
- Unit tests for producers and the enricher
- 80%+ coverage target
👾 GitHub
- Version control
.env.exampletemplate for configuration