digraph DataFlow { rankdir=LR; compound=true; fontname="Helvetica"; node [fontname="Helvetica", fontsize=10]; edge [fontname="Helvetica", fontsize=9]; labelloc="t"; label="Metrics Data Flow Pipeline"; fontsize=14; node [shape=box, style="rounded,filled"]; // Collection subgraph cluster_collect { label="Collection (5s)"; style=filled; fillcolor="#E3F2FD"; psutil [label="psutil\n(CPU, Mem, Disk)", shape=component, fillcolor="#BBDEFB"]; collector [label="Collector\nService", fillcolor="#90CAF9"]; } // Ingestion subgraph cluster_ingest { label="Ingestion"; style=filled; fillcolor="#E8F5E9"; aggregator [label="Aggregator\n(gRPC)", fillcolor="#A5D6A7"]; validate [label="Validate &\nNormalize", shape=diamond, fillcolor="#C8E6C9"]; } // Storage Hot subgraph cluster_hot { label="Hot Path (Real-time)"; style=filled; fillcolor="#FFF3E0"; redis_state [label="Redis\nCurrent State", shape=cylinder, fillcolor="#FFCC80"]; redis_pubsub [label="Redis\nPub/Sub", shape=hexagon, fillcolor="#FFB74D"]; } // Storage Warm subgraph cluster_warm { label="Warm Path (Historical)"; style=filled; fillcolor="#FCE4EC"; raw [label="metrics_raw\n(5s, 24h)", shape=cylinder, fillcolor="#F8BBD9"]; agg_1m [label="metrics_1m\n(1m, 7d)", shape=cylinder, fillcolor="#F48FB1"]; agg_1h [label="metrics_1h\n(1h, 90d)", shape=cylinder, fillcolor="#EC407A"]; } // Consumers subgraph cluster_consume { label="Consumers"; style=filled; fillcolor="#E8EAF6"; alerts [label="Alert\nService", fillcolor="#C5CAE9"]; gateway [label="Gateway\n(WebSocket)", fillcolor="#9FA8DA"]; } // Edge + Browser subgraph cluster_delivery { label="Delivery (AWS)"; style=filled; fillcolor="#F3E5F5"; edge_relay [label="Edge\n(WS Relay)", fillcolor="#E1BEE7"]; browser [label="Browser\n(Dashboard)", fillcolor="#CE93D8"]; } // Flow psutil -> collector [label="Metrics"]; collector -> aggregator [label="gRPC\nStream"]; aggregator -> validate; validate -> redis_state [label="Upsert"]; validate -> redis_pubsub [label="Publish"]; validate -> raw [label="Insert"]; redis_pubsub -> alerts [label="metrics.*"]; redis_pubsub -> gateway [label="metrics.*"]; gateway -> edge_relay [label="WebSocket\nForward"]; edge_relay -> browser [label="WebSocket"]; raw -> agg_1m [label="Continuous\nAggregate", style=dashed]; agg_1m -> agg_1h [label="Hourly\nJob", style=dashed]; }