You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The behavior chaos strategy is designed to inject custom behaviors into system operations right before such an operation is invoked. This strategy is flexible, allowing users to define specific behaviors such as altering the input, simulating resource exhaustion, putting the system in a given state before the actual operation is called, or other operational variations to simulate real-world scenarios.
13
+
The behavior **proactive**chaos strategy is designed to inject custom behaviors into system operations right before such an operation is invoked. This strategy is flexible, allowing users to define specific behaviors such as altering the input, simulating resource exhaustion, putting the system in a given state before the actual operation is called, or other operational variations to simulate real-world scenarios.
12
14
13
15
## Usage
14
16
@@ -66,10 +68,35 @@ var pipeline = new ResiliencePipelineBuilder()
> Please note that the `Chaos.OnBehavior` telemetry event will be reported **only if** the behavior chaos strategy injects a custom behavior which does not throw exception.
94
+
>
95
+
> So, if the behavior is either not injected or injected and throws an exception then there will be no telemetry emitted.
96
+
>
97
+
> Also remember that the `Result` will be **always empty** for the `Chaos.OnBehavior` telemetry event.
98
+
99
+
For further information please check out the [telemetry page](../advanced/telemetry.md).
The fault chaos strategy is designed to introduce faults (exceptions) into the system, simulating real-world scenarios where operations might fail unexpectedly. It is configurable to inject specific types of exceptions or use custom logic to generate faults dynamically.
13
+
The fault **proactive**chaos strategy is designed to introduce faults (exceptions) into the system, simulating real-world scenarios where operations might fail unexpectedly. It is configurable to inject specific types of exceptions or use custom logic to generate faults dynamically.
12
14
13
15
## Usage
14
16
@@ -87,10 +89,35 @@ var pipeline = new ResiliencePipelineBuilder()
> Please note that the `Chaos.OnFault` telemetry event will be reported **only if** the fault chaos strategy injects an exception which is wrapped into a `ValueTask`.
115
+
>
116
+
> So, if the fault is either not injected or injected and throws an exception then there will be no telemetry emitted.
117
+
>
118
+
> Also remember that the `Result` will be **always empty** for the `Chaos.OnFault` telemetry event.
119
+
120
+
For further information please check out the [telemetry page](../advanced/telemetry.md).
Copy file name to clipboardExpand all lines: docs/chaos/index.md
+19-15Lines changed: 19 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,10 +52,14 @@ This section highlights the major differences compared to the [`Polly.Contrib.Si
52
52
-**Unified configuration options**: The `InjectOptionsBase` and `InjectOptionsAsyncBase` are now consolidated into `ChaosStrategyOptions`. This change brings Simmy in line with the Polly v8 API, offering built-in support for options-based configuration and seamless integration of synchronous and asynchronous executions.
53
53
-**Chaos strategies enabled by default**: Adding a chaos strategy (previously known as monkey policy) now means it's active right away. This is a departure from earlier versions, where the monkey policy had to be explicitly enabled.
54
54
-**API changes**: The new version of Simmy introduces several API updates. While this list isn't complete, it includes key changes like renaming `Inject` to `AddChaos` and switching from `Result` to `Outcome`. Here are some specific renames:
55
-
-`InjectException` is now `AddChaosFault`
56
-
-`InjectResult` is now `AddChaosOutcome`
57
-
-`InjectBehavior` is now `AddChaosBehavior`
58
-
-`InjectLatency` is now `AddChaosLatency`
55
+
56
+
| From | To |
57
+
|-------------------|--------------------|
58
+
|`InjectException`|`AddChaosFault`|
59
+
|`InjectResult`|`AddChaosOutcome`|
60
+
|`InjectBehavior`|`AddChaosBehavior`|
61
+
|`InjectLatency`|`AddChaosLatency`|
62
+
59
63
-**Sync and async unification**: Before, Simmy had various methods to set policies like `InjectLatency`, `InjectLatencyAsync`, `InjectLatency<T>`, and `InjectLatencyAsync<T>`. With the new version based on Polly v8, these methods have been combined into a single `AddChaosLatency` extension that works for both `ResiliencePipelineBuilder` and `ResiliencePipelineBuilder<T>`. These rules are covering all types of chaos strategies (Outcome, Fault, Latency, and Behavior).
60
64
61
65
## Motivation
@@ -82,12 +86,12 @@ Chaos strategies (formerly known as Monkey strategies) are in essence a [Resilie
82
86
83
87
### Built-in strategies
84
88
85
-
| Strategy |Reactive | What does the strategy do?|
|[Fault](fault.md)|Proactive | Injects exceptions in your system. |
92
+
|[Outcome](outcome.md)|Reactive | Injects fake outcomes (results or exceptions) in your system. |
93
+
|[Latency](latency.md)|Proactive | Injects latency into executions before the calls are made. |
94
+
|[Behavior](behavior.md)|Proactive | Allows you to inject *any* extra behavior, before a call is placed. |
91
95
92
96
## Common options across strategies
93
97
@@ -114,12 +118,12 @@ All the strategies' options implement the [`ChaosStrategyOptions`](xref:Polly.Si
114
118
115
119
## Telemetry
116
120
117
-
The telemetry of chaos strategies is seamlessly integrated with Polly [telemetry infrastructure](../advanced/telemetry.md). The chaos strategies produce the following events:
121
+
The telemetry of chaos strategies is seamlessly integrated with Polly [telemetry infrastructure](../advanced/telemetry.md). The chaos strategies produce the following information events:
The latency chaos strategy is designed to introduce controlled delays into system operations, simulating network latency or slow processing times. This strategy helps in assessing and improving the resilience of applications against increased response times.
13
+
The latency **proactive**chaos strategy is designed to introduce controlled delays into system operations, simulating network latency or slow processing times. This strategy helps in assessing and improving the resilience of applications against increased response times.
12
14
13
15
## Usage
14
16
@@ -90,15 +92,45 @@ var pipeline = new ResiliencePipelineBuilder()
> Please note that the `Chaos.OnLatency` telemetry event will be reported **only if** the latency chaos strategy injects a positive delay.
127
+
>
128
+
> So, if the latency is not injected then there will be no telemetry emitted. Also if injected but the latency is negative or the `LatencyGenerator` throws an exception then there will be no telemetry emitted.
129
+
>
130
+
> Also remember that the `Result` will be **always empty** for the `Chaos.OnLatency` telemetry event.
131
+
132
+
For further information please check out the [telemetry page](../advanced/telemetry.md).
The outcome chaos strategy is designed to inject or substitute fake results into system operations. This allows testing how an application behaves when it receives different types of responses, like successful results, errors, or exceptions.
13
+
The outcome **reactive**chaos strategy is designed to inject or substitute fake results into system operations. This allows testing how an application behaves when it receives different types of responses, like successful results, errors, or exceptions.
13
14
14
15
## Usage
15
16
@@ -79,10 +80,38 @@ var pipeline = new ResiliencePipelineBuilder<HttpResponseMessage>()
0 commit comments