Tago.Extensions.Healthcheck
6.0.0
dotnet add package Tago.Extensions.Healthcheck --version 6.0.0
NuGet\Install-Package Tago.Extensions.Healthcheck -Version 6.0.0
<PackageReference Include="Tago.Extensions.Healthcheck" Version="6.0.0" />
paket add Tago.Extensions.Healthcheck --version 6.0.0
#r "nuget: Tago.Extensions.Healthcheck, 6.0.0"
// Install Tago.Extensions.Healthcheck as a Cake Addin #addin nuget:?package=Tago.Extensions.Healthcheck&version=6.0.0 // Install Tago.Extensions.Healthcheck as a Cake Tool #tool nuget:?package=Tago.Extensions.Healthcheck&version=6.0.0
Health Check Response Writer
Overview
The Health Check Response Writer is a NuGet package for C# that allows you to customize health check responses, manage routes for each endpoint, and set a parent route for all health endpoints. This package is designed to provide flexibility and control over how health check information is presented and accessed in your application.
Features
- Customizable Responses: Tailor the health check responses to meet your specific needs.
- Response Services: Utilize built-in services to generate health check responses.
- Route Management: Easily manage routes for individual health check endpoints.
- Parent Route Configuration: Set a parent route for all health endpoints to streamline access.
Installation
To install the Health Check Response Writer package, run the following command in the Package Manager Console:
Install-Package Tago.Extensions.Healthcheck
Usage
Basic Setup
Add the package to your project:
using Tago.Extensions.Healthcheck;
Configure the health check response writer in your
Program.cs
/Startup.cs
:builder.Services.AddHealthChecks() .WithApplicationInfo((sp, o) => { o.Add("appName", "test"); o.Add("environment", "test"); }) .AddMemoryHealthcheck(1024) .AddCheck<TestHealth>("test", tags: new[] { "startup" }) //.AddHttpEndpointHealthCheck("http", new Microsoft.Extensions.Diagnostics.HealthChecks.HttpEndpointHealthCheckOptions //{ // Url = "https://tag-solutions.com", // Method = HttpRequestMethods.Get, // ReadResponse = false, // TimeOut = TimeSpan.FromSeconds(5) //}) ; app.MapHealthCheckRoutes() .MapReadynessEndpoint(predicate: (reg) => { return reg?.Tags?.Contains("startup") != true; }) .MapLivenessEndpoint() .MapConfiguarionEndpoint("config") .MapEndpoint("started", (reg) => { return reg?.Tags?.Contains("startup") == true; }) ;
Customizing Responses
You can customize the health check responses by modifying the ConfigureResponse
option. This allows you to format the response based on your requirements.
builder.Services.AddHealthCheckResponseWriter<MyResponseWriter>();
app.MapHealthCheckRoutes("hc")
.MapEndpoint<MyResponseWriter>("some-endpoint");
Setting a Parent Route
You can set a parent route for all health endpoints to make them accessible under a common path.
app.MapHealthCheckRoutes("service-health")
.MapReadynessEndpoint("ready")
.MapLivenessEndpoint("alive")
;
License
This project is licensed under the MIT License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. 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. |
.NET Core | netcoreapp3.1 is compatible. |
-
.NETCoreApp 3.1
-
net6.0
-
net8.0
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 |
---|---|---|
6.0.0 | 149 | 8/21/2024 |
3.1.1-preview-20240716-01 | 120 | 8/20/2024 |
3.1.1-preview-20240715-01 | 115 | 8/20/2024 |
3.1.1-preview-20240701-01 | 122 | 8/8/2024 |