Skip to content

Commit b91801a

Browse files
Updates instructions how to fix compatibility issue with App Insights (#45374)
1 parent a3d88aa commit b91801a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/core/resilience/http-resilience.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ The preceding code:
9090
- Creates a <xref:Microsoft.Extensions.DependencyInjection.ServiceCollection> instance.
9191
- Adds the standard resilience handler to all <xref:System.Net.Http.HttpClient> instances.
9292
- For the "custom" <xref:System.Net.Http.HttpClient>:
93-
- Removes all predefined resilience handlers that were previously registered. This is useful when you want to start with a clean state to add your own custom strategies.
94-
- Adds a `StandardHedgingHandler` to the <xref:System.Net.Http.HttpClient>. You can replace `AddStandardHedgingHandler()` with any strategy that suits your application's needs, such as retry mechanisms, circuit breakers, or other resilience techniques.
93+
- Removes all predefined resilience handlers that were previously registered. This is useful when you want to start with a clean state to add your own custom strategies.
94+
- Adds a `StandardHedgingHandler` to the <xref:System.Net.Http.HttpClient>. You can replace `AddStandardHedgingHandler()` with any strategy that suits your application's needs, such as retry mechanisms, circuit breakers, or other resilience techniques.
9595

9696
### Standard resilience handler defaults
9797

@@ -293,7 +293,7 @@ There's a build time check that verifies if you're using `Grpc.Net.ClientFactory
293293

294294
### Compatibility with .NET Application Insights
295295

296-
If you're using .NET Application Insights, then enabling resilience functionality in your application could cause all Application Insights telemetry to be missing. The issue occurs when resilience functionality is registered before Application Insights services. Consider the following sample causing the issue:
296+
If you're using .NET Application Insights version **2.22.0** or lower, then enabling resilience functionality in your application could cause all Application Insights telemetry to be missing. The issue occurs when resilience functionality is registered before Application Insights services. Consider the following sample causing the issue:
297297

298298
```csharp
299299
// At first, we register resilience functionality.
@@ -303,7 +303,7 @@ services.AddHttpClient().AddStandardResilienceHandler();
303303
services.AddApplicationInsightsTelemetry();
304304
```
305305

306-
The issue is caused by the following [bug](https://github.com/microsoft/ApplicationInsights-dotnet/issues/2879) in Application Insights and can be fixed by registering Application Insights services before resilience functionality, as shown below:
306+
The issue can be fixed by updating .NET Application Insights to version **2.23.0** or higher. If you cannot update it, then registering Application Insights services before resilience functionality, as shown below, will fix the issue:
307307

308308
```csharp
309309
// We register Application Insights first, and now it will be working correctly.

0 commit comments

Comments
 (0)