Docs Home
Start your 30 day free trial.
START FOR FREE

Using Failure Flags by proxy

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.

This page is for using Failure Flags' traffic proxying mode to run reliability tests. If you're looking for information on running the Failure Flags agent behind a proxy, such as a corporate firewall or private VPC, see running Failure Flags behind a proxy.

‍

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 application, letting you simulate response delays, errors, or corrupted responses. It automatically creates the ingress and http-ingress Failure Flags for inbound traffic, and a response Failure Flag for traffic that your application sends in response to a request from another application.

‍

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 application communicates with, Gremlin creates a Failure Flag named dependency-<dependency hostname>. Gremlin also creates a general Failure Flag named egress for any and all dependency 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_SIDECAR_ENABLED Set to true, yes, or 1 to enable the Failure Flags sidecar. If unset or set to any other value, the sidecar will operate in NOOP mode.
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 enables experiments on inbound network calls to your application. It automatically creates the ingress http-ingress (for HTTP traffic), and response flags.

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

Environment variable Config file property Description
GREMLIN_INGRESS_PROXY_ENABLED ingress_proxy_enabled Set to true to enable the reverse proxy for inbound traffic.
GREMLIN_INGRESS_PROXY_PORT ingress_proxy_port Set to the port number that the ingress proxy will bind to (e.g., :5035).
GREMLIN_INGRESS_PROXIED_ENDPOINT ingress_proxied_endpoint The URL of your application. This is required.

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

GREMLIN_INGRESS_SERVICE_CERTIFICATE ingress_service_certificate Optional. A PEM-encoded server certificate (or chain) for the ingress proxy. Setting a certificate turns on TLS for the ingress proxy. Set only one of ingress_service_certificate, ingress_service_certificate_file, or ingress_service_certificate_arn.
GREMLIN_INGRESS_SERVICE_CERTIFICATE_FILE ingress_service_certificate_file Optional. The path to a file that contains the PEM-encoded server certificate (or chain).
GREMLIN_INGRESS_SERVICE_CERTIFICATE_ARN ingress_service_certificate_arn Optional. The ARN of an AWS Secrets Manager secret or SSM Parameter Store parameter that contains the PEM-encoded server certificate (or chain).
GREMLIN_INGRESS_SERVICE_PRIVATE_KEY ingress_service_private_key Required if you set a certificate. The PEM-encoded private key that matches the server certificate. Set only one of ingress_service_private_key, ingress_service_private_key_file, or ingress_service_private_key_arn.
GREMLIN_INGRESS_SERVICE_PRIVATE_KEY_FILE ingress_service_private_key_file Optional. The path to a file that contains the PEM-encoded private key.
GREMLIN_INGRESS_SERVICE_PRIVATE_KEY_ARN ingress_service_private_key_arn Optional. The ARN of an AWS Secrets Manager secret or SSM Parameter Store parameter that contains the PEM-encoded private key.

Serving TLS from the ingress proxy

By default, the ingress proxy accepts plain HTTP. If callers need to reach your service over HTTPS, the ingress proxy can terminate TLS itself. It accepts TLS connections from callers, then forwards each request to the ingress_proxied_endpoint.

To turn on TLS, give the sidecar a server certificate and its matching private key, both PEM encoded. You can provide each one inline, as a file path, or as an AWS Secrets Manager or SSM Parameter Store ARN. For example, with files mounted into the sidecar container:

YAML

ingress_proxy_enabled: true
ingress_proxy_port: :8443
ingress_proxied_endpoint: http://localhost:8080
ingress_service_certificate_file: /etc/gremlin/tls/server.crt
ingress_service_private_key_file: /etc/gremlin/tls/server.key
  
  

Point your load balancer or callers at the ingress proxy port using HTTPS.

Dependency proxy

The dependency proxy mode enables experiments on outbound network calls to external endpoints. For each dependency your application communicates with, Gremlin automatically creates a Failure Flag named dependency-<dependency name>. Gremlin also creates a generic egress Failure Flag for all dependency 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.
GREMLIN_DEPENDENCY_HTTP_PROXY dependency_http_proxy Optional. The URL of an upstream proxy, such as a corporate proxy, that the dependency proxy sends http:// requests to. For example, http://proxy.example.com:3128. Defaults to none, which means requests go directly to the destination.
GREMLIN_DEPENDENCY_HTTPS_PROXY dependency_https_proxy Optional. The URL of an upstream proxy that the dependency proxy sends https:// requests to. HTTPS requests don't fall back to GREMLIN_DEPENDENCY_HTTP_PROXY, so if one proxy handles both, set both variables. Defaults to none.
GREMLIN_DEPENDENCY_NO_PROXY dependency_no_proxy Optional. A comma-separated list of hosts that the dependency proxy connects to directly instead of through the upstream proxy. For example, internal.example.com,.svc.cluster.local,10.0.0.0/8. Only applies when GREMLIN_DEPENDENCY_HTTP_PROXY or GREMLIN_DEPENDENCY_HTTPS_PROXY is set.
HTTP_PROXY Set to http://localhost:5034, or to the address in GREMLIN_DEPENDENCY_PROXY_PORT if you changed it.
HTTPS_PROXY Set to http://localhost:5034. Use http:// here, not https://. The dependency proxy itself listens on plain HTTP, and your application's HTTPS requests still use TLS end to end.
NO_PROXY Recommended. A comma-separated list of hosts your application should connect to directly. Include localhost,127.0.0.1 so that the Failure Flags SDK and other local traffic don't go through the proxy. Add any other hosts that you don't want Failure Flags for.

‍

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.

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, or else you will need to provide your own, equivalent, bootstrap script.

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 proxy modes are enabled. You may not see all of these flags for all applications, depending on your configuration.

‍

dependency-<name>

Gremlin can automatically identify HTTP/HTTPS endpoints that your application frequently communicates with. When the dependency proxy is enabled, each of these endpoints will be listed as its own Failure Flag named dependency-<hostname>.

‍

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 application. 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 applications. At present, only the crash attribute is supported. The payload specifies the exit code and the log message:

{"crash":{"code":1,"message":"Segfault"}}

‍

response

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

On this page
Back to top