flowchart TB
Burst["5x ingest burst begins"]:::src
G1["Request rate and CPU climb per gateway pod"]:::hpa
G2["HPA compares live metric to target"]:::hpa
G3["HPA adds gateway replicas"]:::hpa
G4["Requests spread across more pods, CPU normalizes"]:::hpa
K1["Kafka consumer lag grows on xapi.statements.raw"]:::keda
K2["KEDA scaler polls the lag metric"]:::keda
K3["KEDA adds processor replicas, each claiming idle partitions"]:::keda
K4["Replicas drain backlog over the next minute, lag returns to baseline"]:::keda
Burst --> G1 --> G2 --> G3 --> G4
Burst --> K1 --> K2 --> K3 --> K4
classDef src fill:#37474f,stroke:#1c2529,color:#fff,font-size:13px
classDef hpa fill:#2a9d8f,stroke:#1f7a6f,color:#fff,font-size:13px
classDef keda fill:#7b6cc4,stroke:#544a91,color:#fff,font-size:13px
linkStyle default stroke:#999,stroke-width:2px