HTTP resiliency features don't work with the .NET gRPC client
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 894
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 23
Description
The HTTP resiliency features, including those added by the `IHttpClientBuilder.AddStandardResilienceHandler` method, don't apply to gRPC calls despite them going through configured `HttpClient` instances. This is due to the gRPC stack not exposing error details at the HTTP request level in the way that the resiliency features expect (e.g. using HTTP status codes).
The following code example, typical of setting up a gRPC client in a .NET server application, will not actually result in the standard resiliency features being applied to gRPC calls:
```csharp
builder.Services.AddGrpcClient(o => o.Address = new("http://basket-api"))
.AddStandardResilienceHandler();
```
Consider adding support for the standard resiliency patterns to the .NET gRPC client stack in a similar fashion to those added to the `HttpClient` stack so that resiliency features like Circuit Breaker can be easily added by default.
/Cc @JamesNK @davidfowl
Contributor guide
Assessment
This issue has not been assessed yet.