A Go HTTP middleware library for injecting faults like latency, errors, and request rejection into services for resilience testing.
Fault is a Go library that provides HTTP middleware for injecting controlled faults into web services. It enables developers to simulate failure scenarios like latency spikes, HTTP errors, and request rejection to test system resilience and error handling. The package integrates seamlessly with standard Go HTTP handlers and allows fine-grained control over when and where faults are injected.
Go developers building HTTP services who need to test failure resilience, particularly those working on microservices architectures or distributed systems where fault tolerance is critical.
Developers choose Fault for its simple middleware-based approach, minimal performance overhead when disabled, and built-in injectors for common failure scenarios without requiring external dependencies or complex setup.
go fault injection library
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Benchmarks in the README show negligible overhead when faults are disabled (e.g., 1771 ns/op vs 1734 ns/op without faults), making it safe for production use.
Seamlessly works with standard Go HTTP handlers, as shown in the usage example where a fault wraps a main handler with a few lines of code.
Supports percentage-based participation and path filtering (e.g., blocklisting /ping and /health), allowing targeted fault injection without affecting critical endpoints.
Separates injectors for failures and fault logic for execution, prioritizing safety and minimal disruption during normal operation, per the philosophy section.
Only handles HTTP-based failures via middleware; it cannot simulate other system-level faults like network partitioning or database outages without custom extensions.
The README admits the RejectInjector always sends a response, so simulating truly dropped requests requires a workaround with a SlowInjector, which may not be realistic.
Lacks integrated dashboards or alerting for chaos engineering experiments, requiring developers to manually track and analyze fault injection effects.
Tightly coupled to Go's HTTP stack, so it's not suitable for polyglot microservices or projects using other languages without significant adaptation.