Start your 30 day free trial.
START FOR FREE

Using Failure Flags by proxy

Supported platforms:

N/A

Failure Flags supports proxy-based fault injection, letting you run experiments without making changes to your application code. This approach works by intercepting network traffic from your application and injecting failures at the network level. This is the recommended approach to using Failure Flags as it's scalable, minimizes performance impact, and requires less upfront development effort.

How Failure Flags by proxy works

Failure Flags by proxy routes network traffic from your application through a sidecar container, which then forwards the traffic to its destination. The sidecar intercepts this traffic for the sole purpose of orchestrating experiments that your team runs using Gremlin, without requiring code changes.

Setting up Failure Flags by proxy involves:

  1. Deploying the Failure Flags sidecar alongside your application.
  2. Configuring your desired proxy modes (ingress, dependency, or lambda).
  3. Configuring your environment to route traffic through the sidecar proxies.
  4. Generating network traffic to let Gremlin automatically create targets for scoping experiments.
  5. Creating and running experiments using Gremlin.

Proxy modes

The sidecar supports three proxy modes: ingress, dependency, and Lambda runtime API. These proxy modes are not mutually exclusive and can be used in tandem. For example, you can enable the ingress and dependency proxy to experiment on inbound and outbound traffic in an application.

Ingress proxy mode

The ingress proxy intercepts inbound network requests to your service, letting you simulate response delays, errors, or corrupted responses. It automatically creates two new Failure Flags in Gremlin named ingress and http-ingress.

Dependency proxy mode

The dependency proxy intercepts outbound HTTP/HTTPS calls to external dependencies, letting you simulate network failures, slow responses, or API errors. For each HTTP(S) dependency your service communicates with, Gremlin creates a Failure Flag named dependency-<dependency hostname>. Gremlin also creates a general Failure Flag named response for outbound traffic.

Lambda Runtime API proxy mode

The Lambda Runtime API proxy is specifically designed for AWS Lambda functions, as it intercepts Lambda runtime API calls. This simplifies deploying Failure Flags to AWS Lambda.

Enabling Failure Flags by proxy

Running Failure Flags experiments requires enabling one or more proxy modes, which are points in your application’s execution where you can inject faults. Gremlin automatically creates these modes, but you can enable or disable them independently.

Before following any of these steps, you should first follow the instructions for deploying Failure Flags to your platform of choice:

The sidecar supports three proxy modes: ingress, dependency, and Lambda runtime API (lambda for short). You can enable, disable, and configure each proxy mode using configuration file properties or environment variables. Proxy modes are not mutually exclusive and can be used in tandem. For example, you can enable the ingress and dependency modes simultaneously to experiment on inbound and outbound traffic.

Note
Environment variables always take precedence over configuration file values.

Common proxy settings

These options apply to all proxy types:

Environment variable Config file property Description
GREMLIN_PROXY_IDLE_TIMEOUT proxy_idle_connection_timeout Sets the idle timeout for proxied connections. Defaults to 2m (two minutes).
GREMLIN_PROXY_READ_TIMEOUT proxy_read_timeout Sets the read timeout. Defaults to 2m (two minutes).
GREMLIN_PROXY_WRITE_TIMEOUT proxy_write_timeout Sets the write timeout. Defaults to 2m (two minutes).

Ingress proxy

The ingress proxy mode intercepts inbound network requests to your service, letting you simulate response delays, errors, or corrupted responses. It automatically creates two new Failure Flags in Gremlin named ingress and http-ingress.

To enable ingress proxy mode experiments, set the following options:

Environment variable Config file property Description
GREMLIN_INGRESS_PROXY_ENABLED ingress_proxy_enabled Sets the idle timeout for proxied connections. Defaults to 2m (two minutes).
GREMLIN_INGRESS_PROXY_PORT ingress_proxy_port Sets the read timeout. Defaults to 2m (two minutes).
GREMLIN_INGRESS_PROXIED_ENDPOINT ingress_proxied_endpoint The URL of your application. This is required.

For AWS ECS, set this to http://localhost:9080.

Dependency proxy

The dependency proxy intercepts outbound HTTP/HTTPS calls to external endpoints and services. This lets you simulate network failures, slow dependencies, and API errors. For each HTTP(S) dependency your service communicates with, Gremlin automatically creates a Failure Flag named dependency-<dependency name>. Gremlin also creates a generic Failure Flag named response for all outbound traffic.

To enable dependency proxy mode experiments, set the following options:

Environment variable Config file property Description
GREMLIN_DEPENDENCY_PROXY_ENABLED dependency_proxy_enabled Set to true to enable the proxy for dependency traffic.
GREMLIN_DEPENDENCY_PROXY_PORT dependency_proxy_port Set the IP address/hostname and port that the proxy will bind to. Defaults to localhost:5034.

AWS Lambda API proxy

The Lambda Runtime API (lambda for short) proxy is specifically designed for AWS Lambda functions, as it intercepts Lambda runtime API calls. This simplifies deploying Failure Flags to AWS Lambda services.

Your Lambda function(s) must have the AWS_LAMBDA_RUNTIME_API environment variable set to the port where the Lambda proxy is running. The Lambda Layer includes a bootstrap script that automatically sets this variable. You can optionally enable this script by setting the AWS_LAMBDA_EXEC_WRAPPER environment variable to /opt/bootstrap.

To enable Lambda API proxy experiments, set the following options:

Environment variable Config file property Description
GREMLIN_LAMBDA_PROXY_ENABLED lambda_proxy_enabled Set to true to enable the proxy.
GREMLIN_LAMBDA_PROXY_PORT lambda_proxy_port Set the IP address/hostname and port that the proxy will bind to. Defaults to localhost:5033.
AWS_LAMBDA_EXEC_WRAPPER Set to /opt/bootstrap to automatically configure the Lambda proxy on startup. Otherwise, you will need to set AWS_LAMBDA_RUNTIME_API to the port where the Lambda proxy is running.

Automatically-created Failure Flags

These flags are automatically created by Gremlin when certain proxies are enabled. You may not see all of these flags for all services, depending on your configuration.

egress

The egress Failure Flag is a superflag that represents all dependencies rather than a specific one. Selecting this lets you run experiments on all outbound traffic. Gremlin adds this flag when the dependency proxy mode is enabled.

http-ingress

The http-ingress Failure Flag is created when the sidecar detects inbound HTTP or HTTPS traffic to your service. This makes it easy to target HTTP traffic without using selectors. Gremlin adds this flag when the ingress proxy mode is enabled.

ingress

The ingress Failure Flag represents all inbound traffic. Gremlin adds this flag when the ingress proxy mode is enabled. 

process

The process Failure Flag represents the Gremlin sidecar. Running experiments on this Failure Flag will apply the effects to the sidecar. Gremlin adds this flag for all services.

response

The response Failure Flag represents traffic that your service sends in response to a request from another service.

On this page
Back to top