https://github.com/kpol/healthcheckr
A lightweight health check library for .NET and Azure Functions that runs async checks in parallel, preserves execution order and returns a clean JSON response with status, durations and optional error details.
https://github.com/kpol/healthcheckr
Last synced: 5 months ago
JSON representation
A lightweight health check library for .NET and Azure Functions that runs async checks in parallel, preserves execution order and returns a clean JSON response with status, durations and optional error details.
- Host: GitHub
- URL: https://github.com/kpol/healthcheckr
- Owner: kpol
- License: mit
- Created: 2026-01-19T03:58:33.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2026-01-19T07:31:03.000Z (5 months ago)
- Last Synced: 2026-01-19T13:29:14.508Z (5 months ago)
- Language: C#
- Size: 22.5 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# HealthCheckr
Lightweight async health checks for .NET and Azure Functions with ordered results and clean JSON output.
[](https://github.com/kpol/HealthCheckr/actions/workflows/dotnetcore.yml)
[](https://www.nuget.org/packages/HealthCheckr)
## Features
* Async health checks with support for `CancellationToken`
* Preserve registration order in JSON response
* Optional duration tracking per check
* Optional error reporting per check
* Configurable HTTP status codes for Healthy, Degraded, and Unhealthy states
* JSON output with enum status serialized as string
* Compatible with .NET 8+ (future .NET 10 support)
---
## Installation
Install via NuGet:
```bash
dotnet add package HealthCheckr
```
Or via the NuGet Package Manager:
```
PM> Install-Package HealthCheckr
```
---
## Usage
```csharp
using HealthCheckr;
var checker = new HealthChecker()
.AddCheck("Database", async ct => {
// perform your database check
return HealthStatus.Healthy;
}, "Checks database connectivity")
.AddCheck("Cache", async ct => {
// perform cache check
return HealthStatus.Degraded;
}, "Checks Redis cache availability");
var result = await checker.CheckAsync();
Console.WriteLine(result.ToJson());
```
### Example JSON Output
```json
{
"status": "Degraded",
"checks": [
{
"name": "Database",
"description": "Checks database connectivity",
"status": "Healthy",
"durationMs": 12
},
{
"name": "Cache",
"description": "Checks Redis cache availability",
"status": "Degraded",
"durationMs": 8
}
],
"totalDurationMs": 20,
"timestamp": "2026-01-19T11:15:23.123Z"
}
```
---
## Configuration
* `IncludeErrors` – Include exception details for failing checks.
* `IncludeDuration` – Include execution duration per check.
* `HealthyHttpStatusCode` / `DegradedHttpStatusCode` / `UnhealthyHttpStatusCode` – Customize HTTP response codes for overall status.
---
## Contributing
Contributions are welcome. Please open an issue or pull request on GitHub.
---
## License
© Kirill Polishchuk