Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/chaos/behavior.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ var pipeline = new ResiliencePipelineBuilder()

## Defaults

| Property | Default Value | Description |
|----------------------|---------------|------------------------------------------------|
| `OnBehaviorInjected` | `null` | Action executed when the behavior is injected. |
| `BehaviorGenerator` | `null` | Custom behavior to be injected. |
| Property | Default Value | Description |
|----------------------|---------------|------------------------------------------------------------------------------------------------------------------------------|
| `BehaviorGenerator` | `null` | This **mandatory** delegate allows you to inject custom behavior by utilizing information that is only available at runtime. |
| `OnBehaviorInjected` | `null` | If provided then it will be invoked after the behavior injection occurred. |

## Telemetry

Expand Down
8 changes: 4 additions & 4 deletions docs/chaos/fault.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ var pipeline = new ResiliencePipelineBuilder()

## Defaults

| Property | Default Value | Description |
|-------------------|---------------|------------------------------------------------------|
| `OnFaultInjected` | `null` | Action executed when the fault is injected. |
| `FaultGenerator` | `null` | Generates the fault to inject for a given execution. |
| Property | Default Value | Description |
|-------------------|---------------|------------------------------------------------------------------------------------------------------------------------|
| `FaultGenerator` | `null` | This **mandatory** delegate allows you to inject exception by utilizing information that is only available at runtime. |
| `OnFaultInjected` | `null` | If provided then it will be invoked after the fault injection occurred. |

## Telemetry

Expand Down
50 changes: 41 additions & 9 deletions docs/chaos/latency.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

## About

- **Options**: [`ChaosLatencyStrategyOptions`](xref:Polly.Simmy.Latency.ChaosLatencyStrategyOptions)
- **Extensions**: `AddChaosLatency`
- **Strategy Type**: Proactive
- **Option(s)**:
- [`ChaosLatencyStrategyOptions`](xref:Polly.Simmy.Latency.ChaosLatencyStrategyOptions)
- **Extension(s)**:
- `AddChaosLatency`
- **Exception(s)**: -

---

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.
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.

## Usage

Expand Down Expand Up @@ -90,15 +92,45 @@ var pipeline = new ResiliencePipelineBuilder()

## Defaults

| Property | Default Value | Description |
|---------------------|---------------|--------------------------------------------------------|
| `Latency` | `30 seconds` | A `TimeSpan` indicating the delay to be injected. |
| `LatencyGenerator` | `null` | Generates the latency to inject for a given execution. |
| `OnLatencyInjected` | `null` | Action executed when latency is injected. |
| Property | Default Value | Description |
|---------------------|---------------|----------------------------------------------------------------------------------------------------------------------|
| `Latency` | 30 seconds | Defines a **static** delay to be injected. |
| `LatencyGenerator` | `null` | This delegate allows you to **dynamically** inject delay by utilizing information that is only available at runtime. |
| `OnLatencyInjected` | `null` | If provided then it will be invoked after the latency injection occurred. |

> [!NOTE]
> If both `Latency` and `LatencyGenerator` are specified then `Latency` will be ignored.

---

> [!IMPORTANT]
> Please note that if the calculated latency is negative (regardless if it's static or dynamic) then it will not be injected.

## Telemetry

The latency chaos strategy reports the following telemetry events:

| Event Name | Event Severity | When? |
|-------------------|----------------|-----------------------------------------------------------------|
| `Chaos.OnLatency` | `Information` | Just before the strategy calls the `OnLatencyInjected` delegate |

Here are some sample events:

```none
Resilience event occurred. EventName: 'Chaos.OnLatency', Source: '(null)/(null)/Chaos.Latency', Operation Key: '', Result: ''

Resilience event occurred. EventName: 'Chaos.OnLatency', Source: 'MyPipeline/MyPipelineInstance/MyLatencyStrategy', Operation Key: 'MyLatencyInjectedOperation', Result: ''
```

> [!NOTE]
> Please note that the `Chaos.OnLatency` telemetry event will be reported **only if** the latency chaos strategy injects a positive delay.
>
> 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.
>
> Also remember that the `Result` will be **always empty** for the `Chaos.OnLatency` telemetry event.

For further information please check out the [telemetry page](../advanced/telemetry.md).

## Diagrams

### Normal 🐵 sequence diagram
Expand Down