Faultline is a lightweight chaos engineering framework designed to inject faults into your systems using a declarative DSL (Domain Specific Language). It helps test the resilience of applications by introducing controlled network issues, container failures, and conditional chaos actions based on real-time metrics from Prometheus.
Define chaos scenarios in a simple text format:
scenario docker-test {
node test-backend-1 {
delay 15 s
}
}Trigger chaos only when Prometheus metrics meet certain conditions:
scenario docker-auto-chaos {
if (process_resident_memory_bytes > 2000000) == 0 {
node test-backend-1 {
loss 50%
}
}
}Run scenarios that directly target Docker containers.
- Delay (latency injection)
- Jitter
- Packet loss
- Bandwidth throttling
Works with Prometheus queries for conditional checks.
- Linux VM / Host (Ubuntu 20.04+ recommended)
- Python 3.10+
- Docker Engine & Docker Compose
- Prometheus (running at
http://localhost:9090) - pip + virtualenv
- Clone the repository:
git clone https://github.com/yourusername/faultline.git
cd faultline- Create and activate a virtual environment:
python3 -m venv myenv
source myenv/bin/activate- Install dependencies:
pip install -r requirements.txt- (Optional) Allow non-root Docker access:
sudo usermod -aG docker $USER
newgrp docker- Run Prometheus:
docker run -d --name prometheus -p 9090:9090 prom/prometheusOr configure your own prometheus.yml.
- Write a scenario file (
test.chaos):
scenario docker-test {
node backend {
restart
}
}- Run Faultline:
python main.py test.chaos --target docker- Conditional example:
scenario docker-auto-chaos {
if (container_cpu_usage_seconds_total > 0.8){
link frontend -> backend {
bandwidth 5mbps duration 30 s
}
}
}