# Chaos Middleware

The Chaos Middleware lets you practice chaos engineering on the application level by injecting delays and faults to simulate turbulent conditions. By specifying routes, the Chaos Middleware enables you to minimize the blast radius and keep the focus on the interesting parts of your application.

# Platforms

The Chaos Middleware is an application layer that hooks into your application in order to introduce chaos. Currently following languages and platforms are supported:

# Usage

The attack on the application that include the Chaos Middleware are possible through:

  • Chaos Panel: Attack your application using Chaos Panel in Azure DevOps.
  • Request headers: Attack your applications with header information in your requests.

# Chaos Panel

If you are interested in leveraging the Chaos Panel please read this guide for detailed instructions.

# Request header

Once you installed the Chaos Middleware in your application, the middleware hooks into request/response processing. The x-proofdock-attack header instructs Chaos Middleware what kind of attack should be performed. The following chapter describes the attack schema that such a header has to declare.

# Attack schema

{
  "actions": [
    {
      "name": "delay|fault, required",
      "value": "<value>, required",
      "route": "<addressed-target-route>, optional",
      "probability": "<value-between-1-and-99>, optional"
    }
  ],
  "target": {
    "application": "<application-name>, required",
    "environment": "<application-environment>, optional"
  }
}
  • Actions may be one of:
    • delay - delays the response of the request. The value is measured in seconds.
    • fault - raises an exception. The value takes the fully qualified name of the exception.

Important notes

You are responsible for forwarding the header to the targeted application.

  • Example:

    "x-proofdock-attack": "{
      "actions": [
        {
          "name": "delay",
          "value": "15",
          "probability": "80"
        },
        {
          "name": "fault",
          "value": "path.to.module.CustomException",
          "route": "/recommendations"
        }
      ],
      "target": {
        "application": "webshop-recommendation",
        "environment": "sandbox"
      }
    }"
    

# Configuration

  • The Chaos Middleware expects some configuration variables. Those variables ensure that your service application reacts properly on attacks.

  • Each contribution has its own way of declaring the configuration values. Respectively head to the contribution packages and read the configuration instructions. You will find those under src/contrib-*/README.md in our GitHub repository or under our documentation pages.