HealthCheckPlus.Abstractions
4.0.0
dotnet add package HealthCheckPlus.Abstractions --version 4.0.0
NuGet\Install-Package HealthCheckPlus.Abstractions -Version 4.0.0
<PackageReference Include="HealthCheckPlus.Abstractions" Version="4.0.0" />
<PackageVersion Include="HealthCheckPlus.Abstractions" Version="4.0.0" />
<PackageReference Include="HealthCheckPlus.Abstractions" />
paket add HealthCheckPlus.Abstractions --version 4.0.0
#r "nuget: HealthCheckPlus.Abstractions, 4.0.0"
#:package HealthCheckPlus.Abstractions@4.0.0
#addin nuget:?package=HealthCheckPlus.Abstractions&version=4.0.0
#tool nuget:?package=HealthCheckPlus.Abstractions&version=4.0.0
HealthCheckPlus.Abstractions
Abstractions of HealthCheckPlus - the shared contract between the main package and your own code.
This package holds only the types you need to read HealthCheckPlus state and write your own IHealthCheckPublisher - without depending on ASP.NET Core or the main HealthCheckPlus package's registration/middleware surface. Reach for it from a class library, a background worker, or any project that consumes health state but doesn't itself register or serve health checks.
If you're looking for AddHealthChecksPlus, UseHealthChecksPlus, AddBackgroundPolicy, or the response-writer templates, those live in the main HealthCheckPlus package instead - installing it already brings this one in as a dependency.
Table of Contents
- Installing
- What's in this package
- Usage
- Documentation
- Changelog
- Code of Conduct
- Contributing
- License
Installing
Install-Package HealthCheckPlus.Abstractions [-pre]
dotnet add package HealthCheckPlus.Abstractions [--prerelease]
Note: [-pre]/[--prerelease] usage for pre-release versions
What's in this package
IStateHealthChecksPlus- read cached check results and named aggregates (Status,StatusResult,TryGetHealthy/TryGetNotHealthy/TryGetDegraded/TryGetUnhealthy,ConvertToPlus), or force a manual override (SwitchToUnhealthy/SwitchToDegraded). Resolve it from DI in any project that also references the mainHealthCheckPluspackage, which registers the implementation.IDataHealthPlus- one check's last result (Name,LastResult,Duration,DateRef,Origin), the shapeConvertToPlusreturns.HealthCheckTrigger- what triggered a result (UrlRequest,Background,SwitchTo,None,Default).IHealthCheckPlusPublisher- implement this (instead of the nativeIHealthCheckPublisher) to add an optionalPublisherConditionthe background service checks before invoking your publisher.HealthReportExtensions- convenience extensions on the nativeHealthReport(StatusResult,TryGetHealthy/TryGetNotHealthy/TryGetDegraded/TryGetUnhealthy) for code that only ever sees a plainHealthReport(e.g. inside anIHealthCheckPublisher), without needingIStateHealthChecksPlusat all.
Usage
Reading state from anywhere IStateHealthChecksPlus can be resolved (requires the main HealthCheckPlus package to be registered somewhere in the same host):
public class SomeService(IStateHealthChecksPlus state)
{
public void Report()
{
var overall = state.Status(); // default aggregate
var redis = state.StatusResult("MyRedis"); // one check's last HealthCheckResult
if (state.TryGetUnhealthy(out var unhealthy))
{
foreach (var (name, result) in unhealthy)
{
// ...
}
}
}
}
Writing a publisher with its own opt-in condition:
public class MyPublisher : IHealthCheckPlusPublisher
{
public Func<HealthReport, bool>? PublisherCondition { get; set; } = report => report.Status != HealthStatus.Healthy;
public Task PublishAsync(HealthReport report, CancellationToken cancellationToken)
{
if (report.TryGetUnhealthy(out var unhealthy))
{
// ...
}
return Task.CompletedTask;
}
}
Documentation
- Points of attention - what to know before you build on HealthCheckPlus, in plain language. Start here.
- Architecture - how HealthCheckPlus is put together internally, for maintainers and contributors.
- Operational runbook - how to read a health check response and diagnose common problems, for operators.
- API reference - generated from the XML doc comments.
Changelog
See CHANGELOG.md for the version history (shared with the main package - both are versioned and released together).
Code of Conduct
This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. For more information see the Code of Conduct.
Contributing
See the Contributing guide for developer documentation.
License
Copyright 2023 @ Fernando Cerqueira
| Product | Versions 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 is compatible. 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. |
-
net10.0
-
net8.0
-
net9.0
NuGet packages (1)
Showing the top 1 NuGet packages that depend on HealthCheckPlus.Abstractions:
| Package | Downloads |
|---|---|
|
HealthCheckPlus
HealthCheck with individual policies based on healthy/degraded/unhealthy status and optimized Report Publisher. |
GitHub repositories
This package is not used by any popular GitHub repositories.