PollyHealthChecks 1.0.6

dotnet add package PollyHealthChecks --version 1.0.6
                    
NuGet\Install-Package PollyHealthChecks -Version 1.0.6
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PollyHealthChecks" Version="1.0.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PollyHealthChecks" Version="1.0.6" />
                    
Directory.Packages.props
<PackageReference Include="PollyHealthChecks" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PollyHealthChecks --version 1.0.6
                    
#r "nuget: PollyHealthChecks, 1.0.6"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PollyHealthChecks@1.0.6
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PollyHealthChecks&version=1.0.6
                    
Install as a Cake Addin
#tool nuget:?package=PollyHealthChecks&version=1.0.6
                    
Install as a Cake Tool

PollyHealthChecks

<img src="icon.png" width="100" align="right" />

NuGet NuGet Downloads CI

ASP.NET Core health checks for Polly v8 circuit breakers — expose circuit-breaker state as /health endpoint responses so Kubernetes probes, load balancers, and monitoring dashboards can automatically react to your resilience state.

var stateProvider = new CircuitBreakerStateProvider();

services.AddResiliencePipeline("payments-api", builder =>
    builder.AddCircuitBreaker(new CircuitBreakerStrategyOptions
    {
        StateProvider = stateProvider,
        FailureRatio = 0.5,
        MinimumThroughput = 5,
        BreakDuration = TimeSpan.FromSeconds(30),
    }));

services.AddHealthChecks()
    .AddPollyCircuitBreaker("payments-api", stateProvider);  // ← one line

When the circuit opens, /health returns Unhealthy — Kubernetes stops routing traffic, zero manual intervention required.


Why PollyHealthChecks?

"How do I expose my circuit breaker state in the ASP.NET Core health endpoint?" is one of the most-asked Polly questions. Without this package you must write your own IHealthCheck, wire up CircuitBreakerStateProvider, and map the four circuit states manually. PollyHealthChecks does all of that in a single method call.

Without PollyHealthChecks With PollyHealthChecks
Write a custom IHealthCheck per circuit One AddPollyCircuitBreaker() call
Manually map all 4 circuit states Built-in Closed→Healthy, HalfOpen→Degraded, Open→Unhealthy
Re-implement for every microservice Shared package, consistent behaviour
Forget to update when you add circuits Register alongside the pipeline

Installation

dotnet add package PollyHealthChecks

Targets net6.0, net8.0, and net9.0.

Dependencies: Polly.Core 8.*, Microsoft.Extensions.Diagnostics.HealthChecks 8.*


Quick start

1. Attach a CircuitBreakerStateProvider to your pipeline

using Polly.CircuitBreaker;
using PollyHealthChecks;

var stateProvider = new CircuitBreakerStateProvider();

services.AddResiliencePipeline("downstream-api", builder =>
    builder.AddCircuitBreaker(new CircuitBreakerStrategyOptions
    {
        StateProvider  = stateProvider,
        FailureRatio   = 0.5,
        SamplingDuration  = TimeSpan.FromSeconds(10),
        MinimumThroughput = 5,
        BreakDuration  = TimeSpan.FromSeconds(30),
    }));

2. Register the health check

services.AddHealthChecks()
    .AddPollyCircuitBreaker("downstream-api", stateProvider);

3. Map the health endpoint

app.MapHealthChecks("/health");

State mapping

Circuit state Health status Meaning
Closed Healthy Normal operation
HalfOpen Degraded Testing recovery — partial traffic
Open Unhealthy (configurable) Calls rejected — dependency down
Isolated Unhealthy (configurable) Manually isolated

Kubernetes liveness & readiness probes

Use tags to split circuit breaker health into separate liveness and readiness probes:

services.AddHealthChecks()
    .AddPollyCircuitBreaker("payments-api",   paymentsStateProvider,  tags: ["ready"])
    .AddPollyCircuitBreaker("inventory-api",  inventoryStateProvider, tags: ["ready"])
    .AddPollyCircuitBreaker("auth-api",       authStateProvider,      tags: ["live", "ready"]);

// Liveness — just the critical auth circuit
app.MapHealthChecks("/health/live",  new HealthCheckOptions
{
    Predicate = r => r.Tags.Contains("live"),
});

// Readiness — all dependency circuits
app.MapHealthChecks("/health/ready", new HealthCheckOptions
{
    Predicate = r => r.Tags.Contains("ready"),
});

Kubernetes deployment:

livenessProbe:
  httpGet:
    path: /health/live
    port: 8080
  initialDelaySeconds: 5
  periodSeconds: 10

readinessProbe:
  httpGet:
    path: /health/ready
    port: 8080
  initialDelaySeconds: 5
  periodSeconds: 5

Multiple circuit breakers

Monitor every downstream dependency independently:

services.AddHealthChecks()
    .AddPollyCircuitBreaker("payments-api",   paymentsStateProvider)
    .AddPollyCircuitBreaker("inventory-api",  inventoryStateProvider, failureStatus: HealthStatus.Degraded)
    .AddPollyCircuitBreaker("auth-api",       authStateProvider,      tags: ["ready", "live"])
    .AddPollyCircuitBreaker("email-service",  emailStateProvider,     failureStatus: HealthStatus.Degraded);

Custom failure status

Demote a non-critical circuit to Degraded so a single open circuit doesn't fail the entire readiness check:

services.AddHealthChecks()
    // Critical — Unhealthy when open (default)
    .AddPollyCircuitBreaker("payments-api", paymentsStateProvider)
    // Non-critical — Degraded when open (app still serves traffic)
    .AddPollyCircuitBreaker("analytics-api", analyticsStateProvider,
        failureStatus: HealthStatus.Degraded);

HealthChecks UI integration

Works out-of-the-box with AspNetCore.HealthChecks.UI:

services.AddHealthChecksUI(opts =>
    opts.AddHealthCheckEndpoint("App", "/health"))
    .AddInMemoryStorage();

services.AddHealthChecks()
    .AddPollyCircuitBreaker("payments-api", paymentsStateProvider)
    .AddPollyCircuitBreaker("inventory-api", inventoryStateProvider);

app.MapHealthChecks("/health", new HealthCheckOptions
{
    ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse,
});
app.MapHealthChecksUI();

Full ASP.NET Core example

var builder = WebApplication.CreateBuilder(args);

var paymentsStateProvider  = new CircuitBreakerStateProvider();
var inventoryStateProvider = new CircuitBreakerStateProvider();

builder.Services.AddResiliencePipeline("payments-api", b =>
    b.AddCircuitBreaker(new CircuitBreakerStrategyOptions
    {
        StateProvider     = paymentsStateProvider,
        FailureRatio      = 0.5,
        MinimumThroughput = 5,
        BreakDuration     = TimeSpan.FromSeconds(30),
    }));

builder.Services.AddResiliencePipeline("inventory-api", b =>
    b.AddCircuitBreaker(new CircuitBreakerStrategyOptions
    {
        StateProvider     = inventoryStateProvider,
        FailureRatio      = 0.5,
        MinimumThroughput = 5,
        BreakDuration     = TimeSpan.FromSeconds(30),
    }));

builder.Services.AddHealthChecks()
    .AddPollyCircuitBreaker("payments-api",   paymentsStateProvider,  tags: ["ready", "live"])
    .AddPollyCircuitBreaker("inventory-api",  inventoryStateProvider, tags: ["ready"]);

var app = builder.Build();
app.MapHealthChecks("/health/live",  new HealthCheckOptions { Predicate = r => r.Tags.Contains("live") });
app.MapHealthChecks("/health/ready", new HealthCheckOptions { Predicate = r => r.Tags.Contains("ready") });
app.Run();

Package Downloads Description
PollyEFCore Downloads Polly v8 resilience for EF Core queries and SaveChanges
PollyMediatR Downloads Polly v8 pipelines for MediatR request handlers
PollyBackoff Downloads Jitter, linear & custom backoff for Polly v8 retry
PollyChaos Downloads Fault & latency injection (Simmy for Polly v8)
PollyCaching Downloads Cache-aside resilience strategy for Polly v8
PollyBulkhead Downloads Bulkhead / concurrency limiter for Polly v8
PollyOpenTelemetry Downloads OpenTelemetry metrics & tracing for Polly v8

Support

If PollyHealthChecks is useful in your Kubernetes or monitoring setup, consider supporting the project:

Sponsor

💼 Need .NET / cloud-native help? Visit solidqualitysolutions.com for consulting and architecture services.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.6 99 6/23/2026
1.0.5 101 6/22/2026
1.0.1 99 6/17/2026
1.0.0 98 6/17/2026

1.0.6: Improved NuGet metadata, expanded tags, and overhauled README with Kubernetes probe examples, HealthChecks UI integration, and full Related packages table.
1.0.5: GitHub Sponsors and consulting CTA added to README.
1.0.2: Added net6.0 and net9.0 targets; improved discoverability tags including Kubernetes health probe keywords.