How fmukama/customer-heart-beat-monitoring-system works
This repository is a simulated heart-rate streaming and monitoring product. Its primary workflow generates sensor-like events, publishes them through Kafka, validates and processes them by event time, and persists raw readings and daily aggregates. A parallel operations workflow turns Prometheus alerts into firing/resolved records in PostgreSQL. The graph retains the documented observability and dead-letter capabilities; connections involving unsampled infrastructure configuration are cited to the README rather than inferred from filenames.
Main entry points: consumer.py Kafka consumer · aggregator.py Daily aggregator · server.py Alert webhook server · generator.py Event generator
Components 26
Event Ingestion
- Event generator
simulator/generator.py - Fault injection
simulator/faults.py - Kafka producer
producer/producer.py - Kafka topics
Stream Processing
- Kafka consumer
consumer/consumer.py - Event validation
consumer/validation.py - Dead-letter publisher
consumer/dlq.py - Abnormal classification
consumer/anomaly.py - Daily aggregator
consumer/aggregator.py - Watermark tracking
consumer/watermark.py - Lateness policy
consumer/lateness.py - Daily windows
consumer/windows.py - Window state
consumer/window_state.py
Persistence
- PostgreSQL
- Event and aggregate repository
consumer/repository.py - Lifecycle repository
notifier/repository.py
Alerting and Observability
- Consumer metrics
consumer/metrics.py - Prometheus alert rules
config/alerts.yml - Prometheus
- Alertmanager
- Alert webhook server
notifier/server.py - Alert parser
notifier/payload.py - Notification store
notifier/store.py - Notifier metrics
notifier/metrics.py - Grafana dashboards
config/grafana/dashboards/heartbeat.json
Other components
- Simulated sensors
Connections 27
- Simulated sensors → Event generator: simulates readings
ReadMe.md - Event generator → Fault injection: injects faults
simulator/generator.py - Event generator → Kafka producer: pipes JSON to
simulator/generator.py - Kafka producer → Kafka topics: publishes events
ReadMe.md - Kafka topics → Kafka consumer: delivers events
ReadMe.md - Kafka consumer → Event validation: validates events
consumer/consumer.py - Kafka consumer → Abnormal classification: classifies readings
consumer/consumer.py - Kafka consumer → Daily aggregator: processes event time
consumer/consumer.py - Kafka consumer → Dead-letter publisher: dead-letters invalid
consumer/consumer.py - Daily aggregator → Watermark tracking: tracks progress
consumer/aggregator.py - Daily aggregator → Lateness policy: judges lateness
consumer/aggregator.py - Daily aggregator → Daily windows: assigns day windows
consumer/aggregator.py - Daily aggregator → Window state: updates state
consumer/aggregator.py - Kafka consumer → Event and aggregate repository: persists readings and windows
consumer/consumer.py - Event and aggregate repository → PostgreSQL: reads and writes
consumer/repository.py - Kafka consumer → Consumer metrics: records processing metrics
consumer/consumer.py - Consumer metrics → Prometheus: exposes metrics
ReadMe.md - Prometheus → Prometheus alert rules: evaluates rules
ReadMe.md - Prometheus → Grafana dashboards: provides metrics
ReadMe.md - Prometheus → Alertmanager: routes alerts
ReadMe.md - Alertmanager → Alert webhook server: posts webhooks
ReadMe.md - Alert webhook server → Alert parser: parses alerts
notifier/server.py - Alert webhook server → Notification store: saves notifications
notifier/server.py - Notification store → Lifecycle repository: records transitions
notifier/store.py - Lifecycle repository → PostgreSQL: writes lifecycle rows
notifier/repository.py - Alert webhook server → Notifier metrics: serves metrics
notifier/server.py - Notifier metrics → Prometheus: exposes metrics
ReadMe.md