Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Polly-Contrib/Simmy/llms.txt

Use this file to discover all available pages before exploring further.

Simmy brings chaos engineering to .NET by integrating directly with the Polly resilience framework. Inject exceptions, artificial latency, substitute results, or any arbitrary behavior into your application’s execution paths — all without modifying your production code. Test whether your resilience strategies actually hold up before failures happen in production.

Quickstart

Get Simmy running and inject your first fault in under five minutes.

Chaos Policies

Explore all four chaos policy types: exceptions, results, latency, and behavior.

Configuration

Learn how to control injection rates, enable/disable policies, and drive chaos from external config.

API Reference

Full reference for MonkeyPolicy factory methods, options classes, and fluent builder extensions.

What can Simmy do?

Simmy provides four chaos injection policies, each targeting a different class of failure:

Inject Exception

Throw any exception type at a configurable probability to test your error-handling and retry logic.

Inject Result

Substitute a fake return value (e.g., an HTTP 503) to simulate downstream service faults.

Inject Latency

Add artificial delay before a call is made to validate your timeout and circuit-breaker policies.

Inject Behaviour

Execute any arbitrary action — restart a dependency, corrupt state, or trigger an alert.

How it works

Simmy policies wrap your existing code the same way any Polly policy does. Place a Simmy policy innermost in a PolicyWrap and it will subvert the outbound call at the last moment, while your outer Polly resilience policies (retry, circuit breaker, fallback) respond to the injected chaos exactly as they would in production.
Program.cs
// 1. Build a chaos policy
var chaosPolicy = MonkeyPolicy.InjectException(with =>
    with.Fault(new SocketException(errorCode: 10013))
        .InjectionRate(0.05)   // inject on 5% of calls
        .Enabled()
);

// 2. Wrap with your existing Polly resilience policies
var policyWrap = Policy.Wrap(fallbackPolicy, retryPolicy, chaosPolicy);

// 3. Execute — chaos is transparently injected
policyWrap.Execute(() => myService.GetData());
1

Install the NuGet package

Add Polly.Contrib.Simmy to your project. See Installation for all package manager options.
2

Define a chaos policy

Use the MonkeyPolicy factory with a fluent builder to specify what fault to inject, how often, and under what conditions.
3

Wrap your existing policies

Nest your Simmy policy inside a PolicyWrap so your resilience policies can respond to the injected faults.
4

Control chaos dynamically

Drive injection rates and enabled state from external configuration so you can toggle chaos without redeploying. See Context-Driven Chaos.
Simmy works with Polly v7.0.0 and later, targeting .NET Standard 1.1, 2.0, and 2.1.

Build docs developers (and LLMs) love