Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for alpha.8 #1465

Merged
merged 2 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
## 8.0.0-alpha.8

* Updates for 8.0.0-alpha.7 by [@martincostello](https://github.com/martincostello) in https://github.com/App-vNext/Polly/pull/1433
* Improve logging messages by [@martintmk](https://github.com/martintmk) in https://github.com/App-vNext/Polly/pull/1436
* Rename `BuilderName` to `Name` by [@martintmk](https://github.com/martintmk) in https://github.com/App-vNext/Polly/pull/1437
* Do not record null tags to meter by [@martintmk](https://github.com/martintmk) in https://github.com/App-vNext/Polly/pull/1438
* Fix telemetry test failures by [@martintmk](https://github.com/martintmk) in https://github.com/App-vNext/Polly/pull/1439
* Simplify OutcomeResilienceStrategy by [@martintmk](https://github.com/martintmk) in https://github.com/App-vNext/Polly/pull/1440
* Drop simple circuit breaker by [@martintmk](https://github.com/martintmk) in https://github.com/App-vNext/Polly/pull/1444
* Allow jitter for all backoff types by [@martintmk](https://github.com/martintmk) in https://github.com/App-vNext/Polly/pull/1445
* Rename `Attempt` to `AttemptNumber` by [@martintmk](https://github.com/martintmk) in https://github.com/App-vNext/Polly/pull/1447
* Hide `CircuitBreakerStateProvider.LastHandledOutcome` by [@martintmk](https://github.com/martintmk) in https://github.com/App-vNext/Polly/pull/1446
* Rename `ResilienceStrategyBuilder` to `CompositeStrategyBuilder` by [@martintmk](https://github.com/martintmk) in https://github.com/App-vNext/Polly/pull/1448
* Added `readonly` modifier to private fields which are never changed by [@Lehonti](https://github.com/Lehonti) in https://github.com/App-vNext/Polly/pull/1451
* Reduced nesting levels through block-scoped `using`s and the inversion of an `if` block. by [@Lehonti](https://github.com/Lehonti) in https://github.com/App-vNext/Polly/pull/1453
* Simplify file names by [@martintmk](https://github.com/martintmk) in https://github.com/App-vNext/Polly/pull/1455
* Improve `MultipleStrategiesBenchmark` by [@martintmk](https://github.com/martintmk) in https://github.com/App-vNext/Polly/pull/1457
* Elaborate about synchronous vs asynchronous executions by [@martintmk](https://github.com/martintmk) in https://github.com/App-vNext/Polly/pull/1456
* Fix some typos in XML docs by [@martintmk](https://github.com/martintmk) in https://github.com/App-vNext/Polly/pull/1458
* Make `ReactiveResilienceStrategy` public by [@martintmk](https://github.com/martintmk) in https://github.com/App-vNext/Polly/pull/1460
* Make the `ReactiveResilienceStrategy` type-safe by [@martintmk](https://github.com/martintmk) in https://github.com/App-vNext/Polly/pull/1462
* Use `StrategyHelper` for safe executions and drop redundant methods by [@martintmk](https://github.com/martintmk) in https://github.com/App-vNext/Polly/pull/1463
* Drop unnecessary allocation in circuit breaker by [@martintmk](https://github.com/martintmk) in https://github.com/App-vNext/Polly/pull/1464

## 8.0.0-alpha.7

* Introduce ResilienceStrategyBuilder.Validator by [@martintmk](https://github.com/martintmk) in https://github.com/App-vNext/Polly/pull/1412
Expand Down
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<MicrosoftExtensionsVersion>7.0.0</MicrosoftExtensionsVersion>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<PollyVersion>8.0.0-alpha.7</PollyVersion>
<PollyVersion>8.0.0-alpha.8</PollyVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="coverlet.msbuild" Version="6.0.0" />
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
> Major performance improvements are on the way! Please see our [blog post](https://www.thepollyproject.org/2023/03/03/we-want-your-feedback-introducing-polly-v8/) to learn more and provide feedback in the [related GitHub issue](https://github.com/App-vNext/Polly/issues/1048).
>
> :rotating_light::rotating_light: **Polly v8 feature-complete!** :rotating_light::rotating_light:
> - Polly v8 Alpha 7 is now available on [NuGet.org](https://www.nuget.org/packages/Polly/8.0.0-alpha.7)
> - The Alpha 7 version is considered feature-complete. After completing [review of the API](https://github.com/App-vNext/Polly/pull/1233) to address unresolved issues, we will move on to a Beta release.
> - Polly v8 Alpha 8 is now available on [NuGet.org](https://www.nuget.org/packages/Polly/8.0.0-alpha.8)
> - The Alpha 8 version is considered feature-complete. After completing [review of the API](https://github.com/App-vNext/Polly/pull/1233) to address unresolved issues, we will move on to a Beta release.
> - The v8 docs are not yet finished, but you can take a look at sample code in these locations:
> - Within the repo's new [Samples folder](https://github.com/App-vNext/Polly/tree/main/samples)
> - By reading `Polly.Core`'s [README](https://github.com/App-vNext/Polly/blob/main/src/Polly.Core/README.md)
Expand Down
6 changes: 3 additions & 3 deletions samples/Extensibility/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// ------------------------------------------------------------------------
// Usage of custom strategy
// ------------------------------------------------------------------------
var strategy = new ResilienceStrategyBuilder()
var strategy = new CompositeStrategyBuilder()
// This is custom extension defined in this sample
.AddMyResilienceStrategy(new MyResilienceStrategyOptions
{
Expand All @@ -23,7 +23,7 @@
// SIMPLE EXTENSIBILITY MODEL (INLINE STRATEGY)
// ------------------------------------------------------------------------

strategy = new ResilienceStrategyBuilder()
strategy = new CompositeStrategyBuilder()
// Just add the strategy instance directly
.AddStrategy(new MySimpleStrategy())
.Build();
Expand Down Expand Up @@ -125,7 +125,7 @@ protected override async ValueTask<Outcome<TResult>> ExecuteCore<TResult, TState
public static class MyResilienceStrategyExtensions
{
// Add new extension that works for both "ResilienceStrategyBuilder" and "ResilienceStrategyBuilder<T>"
public static TBuilder AddMyResilienceStrategy<TBuilder>(this TBuilder builder, MyResilienceStrategyOptions options) where TBuilder : ResilienceStrategyBuilderBase
public static TBuilder AddMyResilienceStrategy<TBuilder>(this TBuilder builder, MyResilienceStrategyOptions options) where TBuilder : CompositeStrategyBuilderBase
=> builder.AddStrategy(
// Provide a factory that creates the strategy
context => new MyResilienceStrategy(context.Telemetry, options),
Expand Down
2 changes: 1 addition & 1 deletion samples/GenericStrategies/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// The generic ResilienceStrategyBuilder<T> creates a ResilienceStrategy<T>
// that can execute synchronous and asynchronous callbacks that return T.

ResilienceStrategy<HttpResponseMessage> strategy = new ResilienceStrategyBuilder<HttpResponseMessage>()
ResilienceStrategy<HttpResponseMessage> strategy = new CompositeStrategyBuilder<HttpResponseMessage>()
.AddFallback(new FallbackStrategyOptions<HttpResponseMessage>
{
FallbackAction = _ =>
Expand Down
6 changes: 3 additions & 3 deletions samples/Intro/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// The ResilienceStrategyBuilder creates a ResilienceStrategy
// that can be executed synchronously or asynchronously
// and for both void and result-returning user-callbacks.
ResilienceStrategy strategy = new ResilienceStrategyBuilder()
ResilienceStrategy strategy = new CompositeStrategyBuilder()
// Use convenience extension that accepts TimeSpan
.AddTimeout(TimeSpan.FromSeconds(5))
.Build();
Expand Down Expand Up @@ -37,7 +37,7 @@
// 3. Create and execute a pipeline of strategies
// ------------------------------------------------------------------------

strategy = new ResilienceStrategyBuilder()
strategy = new CompositeStrategyBuilder()
// Add retries using the options
.AddRetry(new RetryStrategyOptions
{
Expand All @@ -51,7 +51,7 @@
_ => PredicateResult.False
},
// Register user callback called whenever retry occurs
OnRetry = args => { Console.WriteLine($"Retrying...{args.Arguments.Attempt} attempt"); return default; },
OnRetry = args => { Console.WriteLine($"Retrying...{args.Arguments.AttemptNumber} attempt"); return default; },
BaseDelay = TimeSpan.FromMilliseconds(400),
BackoffType = RetryBackoffType.Constant,
RetryCount = 3
Expand Down
13 changes: 7 additions & 6 deletions samples/Retries/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// 1. Create a retry strategy that handles all exceptions
// ------------------------------------------------------------------------

ResilienceStrategy strategy = new ResilienceStrategyBuilder()
ResilienceStrategy strategy = new CompositeStrategyBuilder()
// Default retry options handle all exceptions
.AddRetry(new RetryStrategyOptions())
.Build();
Expand All @@ -21,7 +21,7 @@
// 2. Customize the retry behavior
// ------------------------------------------------------------------------

strategy = new ResilienceStrategyBuilder()
strategy = new CompositeStrategyBuilder()
.AddRetry(new RetryStrategyOptions
{
// Specify what exceptions should be retried using PredicateBuilder
Expand All @@ -31,7 +31,8 @@

// The recommended backoff type for HTTP scenarios
// See here for more information: https://github.com/App-vNext/Polly/wiki/Retry-with-jitter#more-complex-jitter
BackoffType = RetryBackoffType.ExponentialWithJitter
BackoffType = RetryBackoffType.Exponential,
UseJitter = true
})
.Build();

Expand All @@ -42,7 +43,7 @@
// 3. Register the callbacks
// ------------------------------------------------------------------------

strategy = new ResilienceStrategyBuilder()
strategy = new CompositeStrategyBuilder()
.AddRetry(new RetryStrategyOptions
{
// Specify what exceptions should be retried using switch expressions
Expand All @@ -53,7 +54,7 @@
},
OnRetry = outcome =>
{
Console.WriteLine($"Retrying attempt {outcome.Arguments.Attempt}...");
Console.WriteLine($"Retrying attempt {outcome.Arguments.AttemptNumber}...");
return default;
}
})
Expand All @@ -66,7 +67,7 @@
// 4. Create an HTTP retry strategy that handles both exceptions and results
// ------------------------------------------------------------------------

ResilienceStrategy<HttpResponseMessage> httpStrategy = new ResilienceStrategyBuilder<HttpResponseMessage>()
ResilienceStrategy<HttpResponseMessage> httpStrategy = new CompositeStrategyBuilder<HttpResponseMessage>()
.AddRetry(new RetryStrategyOptions<HttpResponseMessage>
{
// Specify what exceptions or results should be retried
Expand Down