< Summary - AsyncResponse (Release / net8.0+net10.0 / unit+integration)

Information
Class: Microsoft.Extensions.DependencyInjection.AsyncResponseHealthCheckExtensions
Assembly: AsyncResponse.Core
File(s): /home/runner/work/AsyncResponse/AsyncResponse/src/AsyncResponse.Core/AsyncResponseHealthCheckExtensions.cs
Line coverage
100%
Covered lines: 7
Uncovered lines: 0
Coverable lines: 7
Total lines: 35
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
AddAsyncResponseRecoveryCheck(...)100%22100%

File(s)

/home/runner/work/AsyncResponse/AsyncResponse/src/AsyncResponse.Core/AsyncResponseHealthCheckExtensions.cs

#LineLine coverage
 1using AsyncResponse;
 2using Microsoft.Extensions.DependencyInjection.Extensions;
 3using Microsoft.Extensions.Diagnostics.HealthChecks;
 4
 5namespace Microsoft.Extensions.DependencyInjection;
 6
 7/// <summary>
 8/// Health-check registration for AsyncResponse. This is the one feature deliberately added on the
 9/// health-checks pipeline rather than the fluent <c>AddAsyncResponse()</c> builder, because it
 10/// belongs to <c>AddHealthChecks()</c>.
 11/// </summary>
 12public static class AsyncResponseHealthCheckExtensions
 13{
 14    /// <summary>
 15    /// Adds the <see cref="AsyncResponseRecoveryHealthCheck"/> to the health-check pipeline. It
 16    /// reads the watchdog's cached snapshot (probes never touch the recovery store) and reports at
 17    /// most <c>Degraded</c> — stale flows are an operator signal, not process ill-health, so keep
 18    /// <c>Degraded</c> mapped to HTTP 200 on readiness endpoints (the ASP.NET Core default). The
 19    /// watchdog itself runs by default once <c>AddAsyncResponse()</c> is registered.
 20    /// </summary>
 21    public static IHealthChecksBuilder AddAsyncResponseRecoveryCheck(
 22        this IHealthChecksBuilder builder,
 23        string name = "async-response-recovery",
 24        IEnumerable<string>? tags = null)
 25    {
 326        builder.Services.TryAddSingleton<AsyncResponseWatchdogState>();
 327        builder.Add(new HealthCheckRegistration(
 328            name,
 329            provider => new AsyncResponseRecoveryHealthCheck(provider.GetRequiredService<AsyncResponseWatchdogState>()),
 330            failureStatus: HealthStatus.Degraded,
 331            tags));
 32
 333        return builder;
 34    }
 35}