Problem Statement
Unexpected failures in complex microservices systems cause outages and degrade user experience. Without proactive testing, these failures remain hidden until they cause serious damage, making recovery slow and unpredictable.
┌───────────────┐ ┌───────────────┐ ┌───────────────┐
│ Chaos Tool │──────▶│ Microservices │──────▶│ Monitoring & │
│ (Inject Fault)│ │ System │ │ Alerting │
└───────────────┘ └───────────────┘ └───────────────┘
│ │ ▲
│ │ │
└──────────────────────┴──────────────────────┘This diagram shows a chaos engineering tool injecting faults into a microservices system, which is monitored to detect failures and trigger alerts.
### Before: No chaos engineering class PaymentService: def process_payment(self, amount): # Directly calls external payment gateway response = external_gateway.charge(amount) return response ### After: With chaos engineering fault injection import random class PaymentService: def process_payment(self, amount): # Inject random failure to simulate gateway outage if random.random() < 0.1: # 10% failure rate raise Exception("Simulated payment gateway failure") response = external_gateway.charge(amount) return response