github.com/falzm/chaos (go): Chaos is a HTTP Negroni middleware that can be used to inject chaotic behavior into your web application (such as delays and errors) in a controlled and programmatic way. It can be useful in chaos engineering for testing a distributed system resiliency, or to ensure application observability instrumentation is working as intended.  The Chaos Middleware is configurable on-the-fly via a dedicated management HTTP controller. For earch target route (i.e. the actual HTTP endpoint that will be impacted by this middleware), it is possible to set a chaos specification defining either or both a delay artificially stalling the request processing and an error terminating the request processing with an arbitrary status code and optional message.  For every configuration route, the following URL parameters are mandatory:  The available routes are:  Set the chaos specification for the corresponding target route. The request body format is JSON-formatted and its content type must be "application/json":  Upon successful request, a "204 No Content" status code is returned.  Get the chaos specification currently set for the corresponding target route:  Delete the chaos specification set for the corresponding target route.  Set a 3 seconds delay with a 50% probability and a 504 error with a 100% probability for target route "POST /api/a":  Set a 599 error with message "oh noes" with a 10% probability for target route "GET /api/b":  Get the currently set chaos specification for the target route "GET /api/b":  Delete the currently set chaos specification for the target route "GET /api/b":  Note: requests affected by a chaos specification feature a X-Chaos-Injected-* HTTP header describing the nature of the disruption. Example:
Keywords: chaos-engineering|golang|http|middleware