From 445c51d58dd166a90428867f4b6e5c2c897221c2 Mon Sep 17 00:00:00 2001 From: peter-csala Date: Tue, 23 Apr 2024 10:31:07 +0200 Subject: [PATCH 01/14] Use relative links instead of absolute --- docs/strategies/circuit-breaker.md | 2 +- docs/strategies/fallback.md | 2 +- docs/strategies/hedging.md | 2 +- docs/strategies/rate-limiter.md | 2 +- docs/strategies/retry.md | 2 +- docs/strategies/timeout.md | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/strategies/circuit-breaker.md b/docs/strategies/circuit-breaker.md index fdd85fe78dc..ca73000ef2a 100644 --- a/docs/strategies/circuit-breaker.md +++ b/docs/strategies/circuit-breaker.md @@ -148,7 +148,7 @@ Resilience event occurred. EventName: 'OnCircuitClosed', Source: 'MyPipeline/MyP > > Also the `Result` will be **always empty** for the `OnCircuitHalfOpened` telemetry event. -For further information please check out the [telemetry page](https://www.pollydocs.org/advanced/telemetry). +For further information please check out the [telemetry page](../advanced/telemetry.md). ## Diagrams diff --git a/docs/strategies/fallback.md b/docs/strategies/fallback.md index c77bd0ad173..c5c4012ac5c 100644 --- a/docs/strategies/fallback.md +++ b/docs/strategies/fallback.md @@ -99,7 +99,7 @@ Resilience event occurred. EventName: 'OnFallback', Source: '(null)/(null)/Fallb > > Also remember that the `Result` will be **always populated** for the `OnFallback` telemetry event. -For further information please check out the [telemetry page](https://www.pollydocs.org/advanced/telemetry). +For further information please check out the [telemetry page](../advanced/telemetry.md). ## Diagrams diff --git a/docs/strategies/hedging.md b/docs/strategies/hedging.md index 4ed172c4ec5..e64e1641dbf 100644 --- a/docs/strategies/hedging.md +++ b/docs/strategies/hedging.md @@ -113,7 +113,7 @@ Execution attempt. Source: 'MyPipeline/MyPipelineInstance/Hedging', Operation Ke > > Also remember that `Attempt: '0'` relates to the original execution attempt. -For further information please check out the [telemetry page](https://www.pollydocs.org/advanced/telemetry). +For further information please check out the [telemetry page](../advanced/telemetry.md). ## Concurrency modes diff --git a/docs/strategies/rate-limiter.md b/docs/strategies/rate-limiter.md index 9d720c970e1..74ef5e4678b 100644 --- a/docs/strategies/rate-limiter.md +++ b/docs/strategies/rate-limiter.md @@ -154,7 +154,7 @@ Resilience event occurred. EventName: 'OnRateLimiterRejected', Source: 'MyPipeli > > Also remember that the `Result` will be **always empty** for the `OnRateLimiterRejected` telemetry event. -For further information please check out the [telemetry page](https://www.pollydocs.org/advanced/telemetry). +For further information please check out the [telemetry page](../advanced/telemetry.md). ## Diagrams diff --git a/docs/strategies/retry.md b/docs/strategies/retry.md index 08b6f9cc987..4b4bc349fa3 100644 --- a/docs/strategies/retry.md +++ b/docs/strategies/retry.md @@ -168,7 +168,7 @@ Execution attempt. Source: 'MyPipeline/MyPipelineInstance/MyRetryStrategy', Oper > > Also remember that `Attempt: '0'` relates to the original execution attempt. -For further information please check out the [telemetry page](https://www.pollydocs.org/advanced/telemetry). +For further information please check out the [telemetry page](../advanced/telemetry.md). ## Calculation of the next delay diff --git a/docs/strategies/timeout.md b/docs/strategies/timeout.md index a39f49c2a6a..1cd368d7a81 100644 --- a/docs/strategies/timeout.md +++ b/docs/strategies/timeout.md @@ -153,7 +153,7 @@ Resilience event occurred. EventName: 'OnTimeout', Source: 'MyPipeline/MyPipelin > > Also remember that the `Result` will be **always empty** for the `OnTimeout` telemetry event. -For further information please check out the [telemetry page](https://www.pollydocs.org/advanced/telemetry). +For further information please check out the [telemetry page](../advanced/telemetry.md). ## Diagrams From fa3070c8254590a634874a8eb88adbf9c9a586d7 Mon Sep 17 00:00:00 2001 From: peter-csala Date: Tue, 23 Apr 2024 11:41:33 +0200 Subject: [PATCH 02/14] Add telemetry section to Behavior Chaos --- docs/chaos/behavior.md | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/docs/chaos/behavior.md b/docs/chaos/behavior.md index 3b16ec0a367..974c36d6673 100644 --- a/docs/chaos/behavior.md +++ b/docs/chaos/behavior.md @@ -2,13 +2,15 @@ ## About -- **Options**: [`ChaosBehaviorStrategyOptions`](xref:Polly.Simmy.Behavior.ChaosBehaviorStrategyOptions) -- **Extensions**: `AddChaosBehavior` -- **Strategy Type**: Proactive +- **Option(s)**: + - [`ChaosBehaviorStrategyOptions`](xref:Polly.Simmy.Behavior.ChaosBehaviorStrategyOptions) +- **Extension(s)**: + - `AddChaosBehavior` +- **Exception(s)**: - --- -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. +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. ## Usage @@ -71,6 +73,31 @@ var pipeline = new ResiliencePipelineBuilder() | `OnBehaviorInjected` | `null` | Action executed when the behavior is injected. | | `BehaviorGenerator` | `null` | Custom behavior to be injected. | +## Telemetry + +The behavior chaos strategy reports the following telemetry events: + +| Event Name | Event Severity | When? | +|--------------------|----------------|------------------------------------------------------------------| +| `Chaos.OnBehavior` | `Information` | Just before the strategy calls the `OnBehaviorInjected` delegate | + +Here are some sample events: + +```none +Resilience event occurred. EventName: 'Chaos.OnBehavior', Source: '(null)/(null)/Chaos.Behavior', Operation Key: '', Result: '' + +Resilience event occurred. EventName: 'Chaos.OnBehavior', Source: 'MyPipeline/MyPipelineInstance/MyChaosBehaviorStrategy', Operation Key: 'MyBehaviorInjectedOperation', Result: '' +``` + +> [!NOTE] +> 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. +> +> So, if the behavior is not injected or it is injected and throws an exception then there will be no telemetry emitted. +> +> Also remember that the `Result` will be **always empty** for the `Chaos.OnBehavior` telemetry event. + +For further information please check out the [telemetry page](../advanced/telemetry.md). + ## Diagrams ### Normal 🐵 sequence diagram From c4d520e6d74daee5542234c52736c2231b961410 Mon Sep 17 00:00:00 2001 From: peter-csala Date: Tue, 23 Apr 2024 15:02:08 +0200 Subject: [PATCH 03/14] Add telemetry section to Fault Chaos --- docs/chaos/behavior.md | 2 +- docs/chaos/fault.md | 35 +++++++++++++++++++++++++++++++---- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/docs/chaos/behavior.md b/docs/chaos/behavior.md index 974c36d6673..eec550bd816 100644 --- a/docs/chaos/behavior.md +++ b/docs/chaos/behavior.md @@ -92,7 +92,7 @@ Resilience event occurred. EventName: 'Chaos.OnBehavior', Source: 'MyPipeline/My > [!NOTE] > 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. > -> So, if the behavior is not injected or it is injected and throws an exception then there will be no telemetry emitted. +> So, if the behavior is either not injected or injected and throws an exception then there will be no telemetry emitted. > > Also remember that the `Result` will be **always empty** for the `Chaos.OnBehavior` telemetry event. diff --git a/docs/chaos/fault.md b/docs/chaos/fault.md index d29dbd9c942..8d0ed824d7b 100644 --- a/docs/chaos/fault.md +++ b/docs/chaos/fault.md @@ -2,13 +2,15 @@ ## About -- **Options**: [`ChaosFaultStrategyOptions`](xref:Polly.Simmy.Fault.ChaosFaultStrategyOptions) -- **Extensions**: `AddChaosFault` -- **Strategy Type**: Proactive +- **Option(s)**: + - [`ChaosFaultStrategyOptions`](xref:Polly.Simmy.Fault.ChaosFaultStrategyOptions) +- **Extensions**: + - `AddChaosFault` +- **Exception(s)**: - --- -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. +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. ## Usage @@ -92,6 +94,31 @@ var pipeline = new ResiliencePipelineBuilder() | `OnFaultInjected` | `null` | Action executed when the fault is injected. | | `FaultGenerator` | `null` | Generates the fault to inject for a given execution. | +## Telemetry + +The fault chaos strategy reports the following telemetry events: + +| Event Name | Event Severity | When? | +|-----------------|----------------|---------------------------------------------------------------| +| `Chaos.OnFault` | `Information` | Just before the strategy calls the `OnFaultInjected` delegate | + +Here are some sample events: + +```none +Resilience event occurred. EventName: 'Chaos.OnFault', Source: '(null)/(null)/Chaos.Fault', Operation Key: '', Result: '' + +Resilience event occurred. EventName: 'Chaos.OnFault', Source: 'MyPipeline/MyPipelineInstance/MyChaosFaultStrategy', Operation Key: 'MyFaultInjectedOperation', Result: '' +``` + +> [!NOTE] +> 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`. +> +> So, if the fault is either not injected or injected and throws an exception then there will be no telemetry emitted. +> +> Also remember that the `Result` will be **always empty** for the `Chaos.OnFault` telemetry event. + +For further information please check out the [telemetry page](../advanced/telemetry.md). + ## Diagrams ### Normal 🐵 sequence diagram From 48f421c3f95bd2080555f5848fd871e6c3a52ae5 Mon Sep 17 00:00:00 2001 From: peter-csala Date: Wed, 24 Apr 2024 09:08:06 +0200 Subject: [PATCH 04/14] Add telemetry to Latency Chaos --- docs/chaos/latency.md | 50 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/docs/chaos/latency.md b/docs/chaos/latency.md index fc22f7fab57..47c668727a8 100644 --- a/docs/chaos/latency.md +++ b/docs/chaos/latency.md @@ -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 @@ -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** calculate the 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 From 0f9e52f30c6fdcc025273c7a17eb99a2bc3f5480 Mon Sep 17 00:00:00 2001 From: peter-csala Date: Wed, 24 Apr 2024 09:27:57 +0200 Subject: [PATCH 05/14] Revise defaults descriptions for chaos strategies --- docs/chaos/behavior.md | 8 ++++---- docs/chaos/fault.md | 8 ++++---- docs/chaos/latency.md | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/chaos/behavior.md b/docs/chaos/behavior.md index eec550bd816..40ba295b47d 100644 --- a/docs/chaos/behavior.md +++ b/docs/chaos/behavior.md @@ -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 diff --git a/docs/chaos/fault.md b/docs/chaos/fault.md index 8d0ed824d7b..a2b36a71f16 100644 --- a/docs/chaos/fault.md +++ b/docs/chaos/fault.md @@ -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 diff --git a/docs/chaos/latency.md b/docs/chaos/latency.md index 47c668727a8..6e9aaa7bce2 100644 --- a/docs/chaos/latency.md +++ b/docs/chaos/latency.md @@ -92,11 +92,11 @@ var pipeline = new ResiliencePipelineBuilder() ## Defaults -| Property | Default Value | Description | -|---------------------|---------------|-----------------------------------------------------------------------------------------------------------------------------| -| `Latency` | 30 seconds | Defines a **static** delay to be injected. | -| `LatencyGenerator` | `null` | This delegate allows you to **dynamically** calculate the delay by utilizing information that is only available at runtime. | -| `OnLatencyInjected` | `null` | If provided then it will be invoked after the latency injection occurred. | +| 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. From c5db33fbe699247d7eb54321de49d0bd337b417d Mon Sep 17 00:00:00 2001 From: peter-csala Date: Wed, 24 Apr 2024 10:24:58 +0200 Subject: [PATCH 06/14] Add telemetry section to Outcome --- docs/chaos/outcome.md | 46 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/docs/chaos/outcome.md b/docs/chaos/outcome.md index ed21508877a..ba71f4c7bd7 100644 --- a/docs/chaos/outcome.md +++ b/docs/chaos/outcome.md @@ -2,14 +2,15 @@ ## About -- **Options**: +- **Option(s)**: - [`ChaosOutcomeStrategyOptions`](xref:Polly.Simmy.Outcomes.ChaosOutcomeStrategyOptions`1) -- **Extensions**: `AddChaosOutcome` -- **Strategy Type**: Reactive +- **Extension(s)**: + - `AddChaosOutcome` +- **Exception(s)**: - --- -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. +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. ## Usage @@ -79,10 +80,39 @@ var pipeline = new ResiliencePipelineBuilder() ## Defaults -| Property | Default Value | Description | -|---------------------|---------------|---------------------------------------------------------| -| `OutcomeGenerator` | `null` | Function to generate the outcome for a given execution. | -| `OnOutcomeInjected` | `null` | Action executed when the outcome is injected. | +| Property | Default Value | Description | +|---------------------|---------------|-----------------------------------------------------------------------------------------------------------------------------| +| `OutcomeGenerator` | `null` | This **mandatory** delegate allows you to inject custom outcome by utilizing information that is only available at runtime. | +| `OnOutcomeInjected` | `null` | If provided then it will be invoked after the outcome injection occurred. | + +> [!NOTE] +> Please note this strategy is a **reactive** chaos strategy, but it does not have a **ShouldHandle** delegate. + +## Telemetry + +The outcome chaos strategy reports the following telemetry events: + +| Event Name | Event Severity | When? | +|-------------------|----------------|-----------------------------------------------------------------| +| `Chaos.OnOutcome` | `Information` | Just before the strategy calls the `OnOutcomeInjected` delegate | + +Here are some sample events: + +```none +Resilience event occurred. EventName: 'Chaos.OnOutcome', Source: '(null)/(null)/Chaos.Outcome', Operation Key: '', Result: '' + +Resilience event occurred. EventName: 'Chaos.OnOutcome', Source: 'MyPipeline/MyPipelineInstance/MyOutcomeStrategy', Operation Key: 'MyOutcomeInjectedOperation', Result: '' +``` + +> [!NOTE] +> Please note that the `Chaos.OnOutcome` telemetry event will be reported **only if** the outcome chaos strategy injects an outcome object. +> +> So, if the outcome is not injected or injected but the generator delegate throws an exception then there will be no telemetry emitted. +> +> Also remember that the `Result` will be **always empty** for the `Chaos.OnOutcome` telemetry event. + +For further information please check out the [telemetry page](../advanced/telemetry.md). + ## Diagrams From b64f75c9abf1a040e198d0d82981bf464f435929 Mon Sep 17 00:00:00 2001 From: peter-csala Date: Wed, 24 Apr 2024 10:25:29 +0200 Subject: [PATCH 07/14] Replace mandatory to required --- docs/chaos/behavior.md | 2 +- docs/chaos/fault.md | 2 +- docs/chaos/outcome.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/chaos/behavior.md b/docs/chaos/behavior.md index 40ba295b47d..70596013679 100644 --- a/docs/chaos/behavior.md +++ b/docs/chaos/behavior.md @@ -70,7 +70,7 @@ var pipeline = new ResiliencePipelineBuilder() | Property | Default Value | Description | |----------------------|---------------|------------------------------------------------------------------------------------------------------------------------------| -| `BehaviorGenerator` | `null` | This **mandatory** delegate allows you to inject custom behavior by utilizing information that is only available at runtime. | +| `BehaviorGenerator` | `null` | This required 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 diff --git a/docs/chaos/fault.md b/docs/chaos/fault.md index a2b36a71f16..bc47b63ca94 100644 --- a/docs/chaos/fault.md +++ b/docs/chaos/fault.md @@ -91,7 +91,7 @@ var pipeline = new ResiliencePipelineBuilder() | Property | Default Value | Description | |-------------------|---------------|------------------------------------------------------------------------------------------------------------------------| -| `FaultGenerator` | `null` | This **mandatory** delegate allows you to inject exception by utilizing information that is only available at runtime. | +| `FaultGenerator` | `null` | This required 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 diff --git a/docs/chaos/outcome.md b/docs/chaos/outcome.md index ba71f4c7bd7..7f28ce20a04 100644 --- a/docs/chaos/outcome.md +++ b/docs/chaos/outcome.md @@ -82,7 +82,7 @@ var pipeline = new ResiliencePipelineBuilder() | Property | Default Value | Description | |---------------------|---------------|-----------------------------------------------------------------------------------------------------------------------------| -| `OutcomeGenerator` | `null` | This **mandatory** delegate allows you to inject custom outcome by utilizing information that is only available at runtime. | +| `OutcomeGenerator` | `null` | This required delegate allows you to inject custom outcome by utilizing information that is only available at runtime. | | `OnOutcomeInjected` | `null` | If provided then it will be invoked after the outcome injection occurred. | > [!NOTE] From 800be6465aec205017282b42b269f6d82bb2944f Mon Sep 17 00:00:00 2001 From: peter-csala Date: Wed, 24 Apr 2024 10:27:42 +0200 Subject: [PATCH 08/14] Fix linting issue --- docs/chaos/outcome.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/chaos/outcome.md b/docs/chaos/outcome.md index 7f28ce20a04..b9292e7c790 100644 --- a/docs/chaos/outcome.md +++ b/docs/chaos/outcome.md @@ -113,7 +113,6 @@ Resilience event occurred. EventName: 'Chaos.OnOutcome', Source: 'MyPipeline/MyP For further information please check out the [telemetry page](../advanced/telemetry.md). - ## Diagrams ### Normal 🐵 sequence diagram From 0038671c79578d702a5ff47bb880c4136fcbaa45 Mon Sep 17 00:00:00 2001 From: peter-csala Date: Wed, 24 Apr 2024 10:30:11 +0200 Subject: [PATCH 09/14] Fix linting issue --- docs/chaos/outcome.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/chaos/outcome.md b/docs/chaos/outcome.md index b9292e7c790..410b06ea564 100644 --- a/docs/chaos/outcome.md +++ b/docs/chaos/outcome.md @@ -86,7 +86,7 @@ var pipeline = new ResiliencePipelineBuilder() | `OnOutcomeInjected` | `null` | If provided then it will be invoked after the outcome injection occurred. | > [!NOTE] -> Please note this strategy is a **reactive** chaos strategy, but it does not have a **ShouldHandle** delegate. +> Please note this strategy is a reactive chaos strategy, but it does not have a `ShouldHandle` delegate. ## Telemetry From 4d1e9e5c22ec84071157bc87df183a0d7fd0999b Mon Sep 17 00:00:00 2001 From: peter-csala Date: Wed, 24 Apr 2024 10:44:29 +0200 Subject: [PATCH 10/14] Update chaos index page --- docs/chaos/index.md | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/docs/chaos/index.md b/docs/chaos/index.md index 85e098cd3e0..ed8a4b38e9b 100644 --- a/docs/chaos/index.md +++ b/docs/chaos/index.md @@ -52,10 +52,14 @@ This section highlights the major differences compared to the [`Polly.Contrib.Si - **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. - **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. - **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: - - `InjectException` is now `AddChaosFault` - - `InjectResult` is now `AddChaosOutcome` - - `InjectBehavior` is now `AddChaosBehavior` - - `InjectLatency` is now `AddChaosLatency` + +| From | To | +|-------------------|--------------------| +| `InjectException` | `AddChaosFault` | +| `InjectResult` | `AddChaosOutcome` | +| `InjectBehavior` | `AddChaosBehavior` | +| `InjectLatency` | `AddChaosLatency` | + - **Sync and async unification**: Before, Simmy had various methods to set policies like `InjectLatency`, `InjectLatencyAsync`, `InjectLatency`, and `InjectLatencyAsync`. 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`. These rules are covering all types of chaos strategies (Outcome, Fault, Latency, and Behavior). ## Motivation @@ -82,12 +86,12 @@ Chaos strategies (formerly known as Monkey strategies) are in essence a [Resilie ### Built-in strategies -| Strategy | Reactive | What does the strategy do? | -|-------------------------|----------|----------------------------------------------------------------------| -| [Fault](fault.md) | No | Injects exceptions in your system. | -| [Outcome](outcome.md) | Yes | Injects fake outcomes (results or exceptions) in your system. | -| [Latency](latency.md) | No | Injects latency into executions before the calls are made. | -| [Behavior](behavior.md) | No | Allows you to inject *any* extra behavior, before a call is placed. | +| Strategy | Type | What does the strategy do? | +|-------------------------|-----------|---------------------------------------------------------------------| +| [Fault](fault.md) | Proactive | Injects exceptions in your system. | +| [Outcome](outcome.md) | Reactive | Injects fake outcomes (results or exceptions) in your system. | +| [Latency](latency.md) | Proactive | Injects latency into executions before the calls are made. | +| [Behavior](behavior.md) | Proactive | Allows you to inject *any* extra behavior, before a call is placed. | ## Common options across strategies @@ -114,12 +118,14 @@ All the strategies' options implement the [`ChaosStrategyOptions`](xref:Polly.Si ## Telemetry -The telemetry of chaos strategies is seamlessly integrated with Polly [telemetry infrastructure](../advanced/telemetry.md). The chaos strategies produce the following events: +The telemetry of chaos strategies is seamlessly integrated with Polly [telemetry infrastructure](../advanced/telemetry.md). The chaos strategies produce the following information events: -- `Chaos.OnFault` -- `Chaos.OnOutcome` -- `Chaos.OnLatency` -- `Chaos.OnBehavior` +| Event | Details | +|--------------------|-------------------------------| +| `Chaos.OnFault` | [Link](fault.md#telemetry) | +| `Chaos.OnOutcome` | [Link](outcome.md#telemetry) | +| `Chaos.OnLatency` | [Link](latency.md#telemetry) | +| `Chaos.OnBehavior` | [Link](behavior.md#telemetry) | ## Patterns From b8bbfdf73b478798f17f622b0c513f42a30141d1 Mon Sep 17 00:00:00 2001 From: peter-csala Date: Wed, 24 Apr 2024 10:48:53 +0200 Subject: [PATCH 11/14] Update telemetry page --- docs/advanced/telemetry.md | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/docs/advanced/telemetry.md b/docs/advanced/telemetry.md index 18b7da1ab13..b6c65cb01f2 100644 --- a/docs/advanced/telemetry.md +++ b/docs/advanced/telemetry.md @@ -1,6 +1,6 @@ # Telemetry -Starting with version 8, Polly provides telemetry for all built-in resilience strategies. +Starting with version 8, Polly provides telemetry for all built-in standard and chaos resilience strategies. ## Usage @@ -140,14 +140,20 @@ Tags: The `event.name` tag is reported by individual resilience strategies. The built-in strategies report the following events: -- `OnRetry` -- `OnFallback` -- `OnHedging` -- `OnTimeout` -- `OnCircuitClosed` -- `OnCircuitOpened` -- `OnCircuitHalfOpened` -- `OnRateLimiterRejected` +| Event | Details | +|-------------------------|----------------------------------------------------| +| `OnRetry` | [Link](../strategies/retry.md#telemetry) | +| `OnFallback` | [Link](../strategies/fallback.md#telemetry) | +| `OnHedging` | [Link](../strategies/hedging.md#telemetry) | +| `OnTimeout` | [Link](../strategies/timeout.md#telemetry) | +| `OnCircuitClosed` | [Link](../strategies/circuit-breaker.md#telemetry) | +| `OnCircuitOpened` | [Link](../strategies/circuit-breaker.md#telemetry) | +| `OnCircuitHalfOpened` | [Link](../strategies/circuit-breaker.md#telemetry) | +| `OnRateLimiterRejected` | [Link](../strategies/rate-limiter.md#telemetry) | +| `Chaos.OnFault` | [Link](../chaos/fault.md#telemetry) | +| `Chaos.OnOutcome` | [Link](../chaos/outcome.md#telemetry) | +| `Chaos.OnLatency` | [Link](../chaos/latency.md#telemetry) | +| `Chaos.OnBehavior` | [Link](../chaos/behavior.md#telemetry) | ### Instrument: `resilience.polly.strategy.attempt.duration` From 3e062eb866630db36e2f42ed5e2fac9197341409 Mon Sep 17 00:00:00 2001 From: peter-csala Date: Wed, 24 Apr 2024 10:52:59 +0200 Subject: [PATCH 12/14] Rename static to fixed --- docs/chaos/latency.md | 4 ++-- docs/strategies/circuit-breaker.md | 2 +- docs/strategies/timeout.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/chaos/latency.md b/docs/chaos/latency.md index 6e9aaa7bce2..d732001e889 100644 --- a/docs/chaos/latency.md +++ b/docs/chaos/latency.md @@ -94,7 +94,7 @@ var pipeline = new ResiliencePipelineBuilder() | Property | Default Value | Description | |---------------------|---------------|----------------------------------------------------------------------------------------------------------------------| -| `Latency` | 30 seconds | Defines a **static** delay to be injected. | +| `Latency` | 30 seconds | Defines a **fixed** 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. | @@ -104,7 +104,7 @@ var pipeline = new ResiliencePipelineBuilder() --- > [!IMPORTANT] -> Please note that if the calculated latency is negative (regardless if it's static or dynamic) then it will not be injected. +> Please note that if the calculated latency is negative (regardless if it's fixed or dynamic) then it will not be injected. ## Telemetry diff --git a/docs/strategies/circuit-breaker.md b/docs/strategies/circuit-breaker.md index ca73000ef2a..4a2bef29d6d 100644 --- a/docs/strategies/circuit-breaker.md +++ b/docs/strategies/circuit-breaker.md @@ -100,7 +100,7 @@ new ResiliencePipelineBuilder().AddCircuitBreaker(optionsSt | `FailureRatio` | 0.1 | The failure-success ratio that will cause the circuit to break/open. `0.1` means 10% failed of all sampled executions. | | `MinimumThroughput` | 100 | The minimum number of executions that must occur within the specified sampling duration. | | `SamplingDuration` | 30 seconds | The time period over which the failure-success ratio is calculated. | -| `BreakDuration` | 5 seconds | Defines a **static** time period for which the circuit will remain broken/open before attempting to reset. | +| `BreakDuration` | 5 seconds | Defines a **fixed** time period for which the circuit will remain broken/open before attempting to reset. | | `BreakDurationGenerator` | `null` | This delegate allows you to **dynamically** calculate the break duration by utilizing information that is only available at runtime (like failure count). | | `ManualControl` | `null` | If provided then the circuit's state can be manually controlled via a `CircuitBreakerManualControl` object. | | `StateProvider` | `null` | If provided then the circuit's current state can be retrieved via a `CircuitBreakerStateProvider` object. | diff --git a/docs/strategies/timeout.md b/docs/strategies/timeout.md index 1cd368d7a81..54897c4486a 100644 --- a/docs/strategies/timeout.md +++ b/docs/strategies/timeout.md @@ -113,7 +113,7 @@ catch (TimeoutRejectedException) | Property | Default Value | Description | |--------------------|---------------|--------------------------------------------------------------------------------------------------------------------------------------| -| `Timeout` | 30 seconds | Defines a **static** period within which the delegate should complete, otherwise it will be cancelled. | +| `Timeout` | 30 seconds | Defines a **fixed** period within which the delegate should complete, otherwise it will be cancelled. | | `TimeoutGenerator` | `null` | This delegate allows you to **dynamically** calculate the timeout period by utilizing information that is only available at runtime. | | `OnTimeout` | `null` | If provided then it will be invoked after the timeout occurred. | From 616fdc72769cbc4d8bb45d1ace47cfe5ef48569b Mon Sep 17 00:00:00 2001 From: peter-csala Date: Wed, 24 Apr 2024 12:26:34 +0200 Subject: [PATCH 13/14] Replace table to bullet list --- docs/advanced/telemetry.md | 26 ++++++++++++-------------- docs/chaos/index.md | 10 ++++------ 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/docs/advanced/telemetry.md b/docs/advanced/telemetry.md index b6c65cb01f2..93559440a85 100644 --- a/docs/advanced/telemetry.md +++ b/docs/advanced/telemetry.md @@ -140,20 +140,18 @@ Tags: The `event.name` tag is reported by individual resilience strategies. The built-in strategies report the following events: -| Event | Details | -|-------------------------|----------------------------------------------------| -| `OnRetry` | [Link](../strategies/retry.md#telemetry) | -| `OnFallback` | [Link](../strategies/fallback.md#telemetry) | -| `OnHedging` | [Link](../strategies/hedging.md#telemetry) | -| `OnTimeout` | [Link](../strategies/timeout.md#telemetry) | -| `OnCircuitClosed` | [Link](../strategies/circuit-breaker.md#telemetry) | -| `OnCircuitOpened` | [Link](../strategies/circuit-breaker.md#telemetry) | -| `OnCircuitHalfOpened` | [Link](../strategies/circuit-breaker.md#telemetry) | -| `OnRateLimiterRejected` | [Link](../strategies/rate-limiter.md#telemetry) | -| `Chaos.OnFault` | [Link](../chaos/fault.md#telemetry) | -| `Chaos.OnOutcome` | [Link](../chaos/outcome.md#telemetry) | -| `Chaos.OnLatency` | [Link](../chaos/latency.md#telemetry) | -| `Chaos.OnBehavior` | [Link](../chaos/behavior.md#telemetry) | +- [`OnRetry`](../strategies/retry.md#telemetry) +- [`OnFallback`](../strategies/fallback.md#telemetry) +- [`OnHedging`](../strategies/hedging.md#telemetry) +- [`OnTimeout`](../strategies/timeout.md#telemetry) +- [`OnCircuitClosed`](../strategies/circuit-breaker.md#telemetry +- [`OnCircuitOpened`](../strategies/circuit-breaker.md#telemetry) +- [`OnCircuitHalfOpened`](../strategies/circuit-breaker.md#telemetry) +- [`OnRateLimiterRejected`](../strategies/rate-limiter.md#telemetry) +- [`Chaos.OnFault`](../chaos/fault.md#telemetry) +- [`Chaos.OnOutcome`](../chaos/outcome.md#telemetry) +- [`Chaos.OnLatency`](../chaos/latency.md#telemetry) +- [`Chaos.OnBehavior`](../chaos/behavior.md#telemetry) ### Instrument: `resilience.polly.strategy.attempt.duration` diff --git a/docs/chaos/index.md b/docs/chaos/index.md index ed8a4b38e9b..9112406bf6f 100644 --- a/docs/chaos/index.md +++ b/docs/chaos/index.md @@ -120,12 +120,10 @@ All the strategies' options implement the [`ChaosStrategyOptions`](xref:Polly.Si The telemetry of chaos strategies is seamlessly integrated with Polly [telemetry infrastructure](../advanced/telemetry.md). The chaos strategies produce the following information events: -| Event | Details | -|--------------------|-------------------------------| -| `Chaos.OnFault` | [Link](fault.md#telemetry) | -| `Chaos.OnOutcome` | [Link](outcome.md#telemetry) | -| `Chaos.OnLatency` | [Link](latency.md#telemetry) | -| `Chaos.OnBehavior` | [Link](behavior.md#telemetry) | +- [`Chaos.OnFault`](fault.md#telemetry) +- [`Chaos.OnOutcome`](outcome.md#telemetry) +- [`Chaos.OnLatency`](latency.md#telemetry) +- [`Chaos.OnBehavior`](behavior.md#telemetry) ## Patterns From 975a8f3a5c2a882935bda69292fe98e8027a1637 Mon Sep 17 00:00:00 2001 From: peter-csala Date: Wed, 24 Apr 2024 12:27:15 +0200 Subject: [PATCH 14/14] Replace table to bullet list --- docs/advanced/telemetry.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/advanced/telemetry.md b/docs/advanced/telemetry.md index 93559440a85..a4a46aadc35 100644 --- a/docs/advanced/telemetry.md +++ b/docs/advanced/telemetry.md @@ -144,7 +144,7 @@ The `event.name` tag is reported by individual resilience strategies. The built- - [`OnFallback`](../strategies/fallback.md#telemetry) - [`OnHedging`](../strategies/hedging.md#telemetry) - [`OnTimeout`](../strategies/timeout.md#telemetry) -- [`OnCircuitClosed`](../strategies/circuit-breaker.md#telemetry +- [`OnCircuitClosed`](../strategies/circuit-breaker.md#telemetry) - [`OnCircuitOpened`](../strategies/circuit-breaker.md#telemetry) - [`OnCircuitHalfOpened`](../strategies/circuit-breaker.md#telemetry) - [`OnRateLimiterRejected`](../strategies/rate-limiter.md#telemetry)