Adopt Polly V8 in Microsoft.Extensions.Resilience#4084
Conversation
src/Libraries/Microsoft.Extensions.Resilience/Resilience/Internal/ResilienceDimensions.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.Resilience/Resilience/Internal/ResilienceEnricher.cs
Outdated
Show resolved
Hide resolved
| _exceptionSummarizer = exceptionSummarizer; | ||
| } | ||
|
|
||
| public void Enrich(EnrichmentContext context) |
There was a problem hiding this comment.
Does context need a null check?
There was a problem hiding this comment.
Nope, it will never be null. Polly infra makes sure of that.
There was a problem hiding this comment.
Adding _ = Throw.IfNull(context); shouldn't hurt.
There was a problem hiding this comment.
We generally reserve Throw.IfNull for public methods. Internally within the context of an assembly, we have the C# compiler's null rules that protect us.
There was a problem hiding this comment.
Yeah, the validation is arbitrary as the null won't ever come here.
src/Libraries/Microsoft.Extensions.Resilience/Resilience/ResilienceContextExtensions.cs
Show resolved
Hide resolved
| /// <param name="services">The services.</param> | ||
| /// <returns>The input <paramref name="services"/>.</returns> | ||
| /// <remarks> | ||
| /// This method adds additional dimensions on top of the default ones that are built-in to Polly library. These include: |
There was a problem hiding this comment.
| /// This method adds additional dimensions on top of the default ones that are built-in to Polly library. These include: | |
| /// This method adds additional dimensions on top of the default ones that are built-in to the Polly library. These include: |
...ibraries/Microsoft.Extensions.Resilience/Resilience/ResilienceServiceCollectionExtensions.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.Resilience/Resilience/ResilienceContextExtensions.cs
Outdated
Show resolved
Hide resolved
| /// </summary> | ||
| /// <param name="context">The context instance.</param> | ||
| /// <returns>The instance of <see cref="RequestMetadata"/> or <see langword="null"/>.</returns> | ||
| /// <exception cref="ArgumentNullException">Thrown when <paramref name="context"/> is <see langword="null"/>.</exception> |
There was a problem hiding this comment.
| /// <exception cref="ArgumentNullException">Thrown when <paramref name="context"/> is <see langword="null"/>.</exception> | |
| /// <exception cref="ArgumentNullException"><paramref name="context"/> is <see langword="null"/>.</exception> |
...ibraries/Microsoft.Extensions.Resilience/Resilience/ResilienceServiceCollectionExtensions.cs
Outdated
Show resolved
Hide resolved
| /// <param name="services">The services.</param> | ||
| /// <param name="configure">The configure result dimensions.</param> | ||
| /// <returns>The input <paramref name="services"/>.</returns> | ||
| /// <exception cref="ArgumentNullException">Thrown when <paramref name="services"/> or <paramref name="configure"/> is <see langword="null"/>.</exception> |
There was a problem hiding this comment.
| /// <exception cref="ArgumentNullException">Thrown when <paramref name="services"/> or <paramref name="configure"/> is <see langword="null"/>.</exception> | |
| /// <exception cref="ArgumentNullException"><paramref name="services"/> or <paramref name="configure"/> is <see langword="null"/>.</exception> |
| _exceptionSummarizer = exceptionSummarizer; | ||
| } | ||
|
|
||
| public void Enrich(EnrichmentContext context) |
There was a problem hiding this comment.
Adding _ = Throw.IfNull(context); shouldn't hurt.
|
@martintmk the new packages must be available in dotnet-public. Here's the instruction to get those there. |
|
I'll leave it here in draft for a while. I need to work on alpha2 to address some issues first. |
1ca201d to
73e1b34
Compare
|
@martintmk is this now superseded by #4108? If so, can we go ahead and close this one? |
This PR is for I'll continue on this one once the #4108 is merged. |
195fda7 to
bf2a8ac
Compare
|
We're still fine-tuning the coverage stuff, so yes it's fine to decrease the coverage numbers. |


This PR adopts the new Polly.Extensions package.
All the features introduced in
Microsoft.Extensions.Resilienceare now built into Polly V8. This makes most of the code in this library redundant.The library will now only expose resilience enrichment and some extensions for
ResilienceContext.API changes:
Old API
New Polly V8 API:
The PR won't be mergeable until we adopt V8 in
Microsoft.Extensions.Http.ResilienceMicrosoft Reviewers: Open in CodeFlow