TL.HealthCheck 0.4.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package TL.HealthCheck --version 0.4.0
                    
NuGet\Install-Package TL.HealthCheck -Version 0.4.0
                    
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="TL.HealthCheck" Version="0.4.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TL.HealthCheck" Version="0.4.0" />
                    
Directory.Packages.props
<PackageReference Include="TL.HealthCheck" />
                    
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 TL.HealthCheck --version 0.4.0
                    
#r "nuget: TL.HealthCheck, 0.4.0"
                    
#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 TL.HealthCheck@0.4.0
                    
#: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=TL.HealthCheck&version=0.4.0
                    
Install as a Cake Addin
#tool nuget:?package=TL.HealthCheck&version=0.4.0
                    
Install as a Cake Tool

🩺 TL.HealthCheck

Extensões fluentes para configuração padronizada de Health Checks, probes de Liveness (/liveness), Readiness (/ready) e dashboard com UI (/health) em ASP.NET Core e Worker Services (.NET 8 e .NET 9).

.NET 8.0 .NET 9.0 License: MIT


📦 Instalação

Adicione o pacote ao seu projeto via .NET CLI:

dotnet add package TL.HealthCheck --version 0.4.0

Ou através do Gerenciador de Pacotes do Visual Studio:

Install-Package TL.HealthCheck -Version 0.4.0

🚀 Como Usar

1. Em Web APIs / Minimal APIs (ASP.NET Core)

Configure os probes padrão no seu Program.cs:

using TL.HealthCheck;

var builder = WebApplication.CreateBuilder(args);

// 1. Registra os Health Checks padrão (Liveness e Readiness)
builder.Services.AddRequiredHealthChecks();

var app = builder.Build();

// 2. Mapeia automaticamente as rotas /health, /liveness e /ready
app.MapRequiredHealthCheck();

app.Run();

2. Adicionando Verificações Customizadas (Banco de Dados, Filas, APIs)

builder.Services.AddRequiredHealthChecks(() => new[]
{
    new CheckConfig("database", new[] { "ready" }, () => HealthCheckResult.Healthy(), TimeSpan.FromSeconds(2)),
    new CheckConfig("redis_cache", new[] { "ready" }, () => HealthCheckResult.Healthy(), TimeSpan.FromSeconds(1)),
    new CheckConfig("payment_gateway", new[] { "live" }, () => HealthCheckResult.Healthy(), TimeSpan.FromSeconds(5))
});

3. Em Worker Services (Background Services)

Mesmo em aplicações que rodam apenas em background sem servidor web nativo, você pode acoplar um web host interno para expor os endpoints de diagnóstico para o Kubernetes:

using TL.HealthCheck;

IHost host = Host.CreateDefaultBuilder(args)
    .AddWorkerServiceHealthChecks() // Acopla um endpoint web interno para /liveness e /ready
    .ConfigureServices(services =>
    {
        services.AddHostedService<QueueProcessingWorker>();
    })
    .Build();

await host.RunAsync();

4. Customização de Rotas via appsettings.json

Você pode sobrescrever as rotas padrão diretamente no arquivo de configuração:

{
  "HealthCheckConfig": {
    "Timeout": 30,
    "Patterns": {
      "Health": "/custom-health",
      "Liveness": "/custom-liveness",
      "Readiness": "/custom-ready"
    }
  }
}

🏛️ Endpoints Padrão Expostos

  • /health: Resposta detalhada formatada para consumo pelo UI Client.
  • /liveness: Sonda de vivacidade para orquestradores (Kubernetes / Docker).
  • /ready: Sonda de prontidão para recebimento de tráfego.
Product Compatible and additional computed target framework versions.
.NET 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.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

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
0.5.0 113 9/28/2026
0.4.0 104 9/25/2026
0.3.1 106 9/22/2026
0.3.0 100 9/18/2026
0.2.0 108 9/11/2026
0.1.0 119 9/7/2026