Skip to content

Commit

Permalink
config http resilience
Browse files Browse the repository at this point in the history
  • Loading branch information
coronabytes committed Jul 24, 2024
1 parent c9613d6 commit d433baf
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Core.Observability/ObservabilityExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Http.Resilience;
using Microsoft.Extensions.Logging;
using OpenTelemetry;
using OpenTelemetry.Logs;
Expand All @@ -18,7 +19,8 @@ public static IHostApplicationBuilder AddObservability(this IHostApplicationBuil
Action<OpenTelemetryLoggerOptions>? configureLogs = null,
Action<MeterProviderBuilder>? configureMetrics = null,
Action<TracerProviderBuilder>? configureTracing = null,
Action<ResourceBuilder>? configureResource = null)
Action<ResourceBuilder>? configureResource = null,
Action<HttpStandardResilienceOptions>? configureHttpResilience = null)
{
builder.Services.AddServiceDiscovery();

Expand All @@ -27,7 +29,10 @@ public static IHostApplicationBuilder AddObservability(this IHostApplicationBuil

builder.Services.ConfigureHttpClientDefaults(http =>
{
http.AddStandardResilienceHandler();
http.AddStandardResilienceHandler(options =>
{
configureHttpResilience?.Invoke(options);
});
http.AddServiceDiscovery();
});

Expand Down

0 comments on commit d433baf

Please sign in to comment.