Lyo.Health
1.0.9
dotnet add package Lyo.Health --version 1.0.9
NuGet\Install-Package Lyo.Health -Version 1.0.9
<PackageReference Include="Lyo.Health" Version="1.0.9" />
<PackageVersion Include="Lyo.Health" Version="1.0.9" />
<PackageReference Include="Lyo.Health" />
paket add Lyo.Health --version 1.0.9
#r "nuget: Lyo.Health, 1.0.9"
#:package Lyo.Health@1.0.9
#addin nuget:?package=Lyo.Health&version=1.0.9
#tool nuget:?package=Lyo.Health&version=1.0.9
Lyo.Health
Interface for services that report their own health. Implement IHealth. There is no central health service. Health returns HealthResult with status, timings, and optional metadata.
Examples
Usage
// File storage
var fileStorage = app.Services.GetRequiredService<IFileStorageService>();
var result = await fileStorage.CheckHealthAsync();
// result.IsHealthy, result.Duration, result.Metadata, result.Message
// Cache
var cache = app.Services.GetRequiredService<ICacheService>();
var result = await cache.CheckHealthAsync();
// RabbitMQ
var mq = app.Services.GetRequiredService<IMqService>();
var result = await mq.CheckHealthAsync();
Contract
public interface IHealth
{
string HealthCheckName { get; }
Task<HealthResult> CheckHealthAsync(CancellationToken ct = default);
}
HealthResult
HealthResult.Healthy(sw.Elapsed, message: null, metadata: new Dictionary<string, object?> { ["database"] = "audit" });
HealthResult.Unhealthy(sw.Elapsed, "Database connection failed", metadata: null, exception: ex);
Contract
HealthCheckNameis a short identifier used to label probe output in hosts, for example"filestorage","cache","rabbitmq","audit-postgres","change-tracker-postgres".CheckHealthAsyncis the live probe. Keep it cheap and short-circuiting, and honor the suppliedCancellationToken.
HealthResult
HealthResult is an immutable, sealed class for the outcome of a probe:
| Member | Type | Notes |
|---|---|---|
IsHealthy |
bool |
true for healthy, false for unhealthy. |
Duration |
TimeSpan |
How long the probe took (typically measured with Stopwatch). |
CheckedAt |
DateTime |
UTC instant the probe completed (set by the factory helpers). |
Message |
string? |
Optional human-readable summary; populated with the exception message on failure. |
Metadata |
IReadOnlyDictionary<string, object?>? |
Connection info, schema, version, key-id, etc. |
Exception |
Exception? |
Captured exception when the probe threw. |
Use the static factories rather than constructing directly:
Usage
Get health from the service directly. Service interfaces (IFileStorageService, ICacheService, IMqService) extend IHealth. Health comes from the service. No separate registration. Hosts that need an aggregate view typically resolve IEnumerable<IHealth> and fan out CheckHealthAsync in parallel, then publish the resulting HealthResult collection.
Dependencies
Generated from ProjectReference / PackageReference (same model as docs/Lyo.ProjectGraph.html).
Lyo.Exceptions(direct, lyo)
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Lyo.Exceptions (>= 1.0.9)
-
net10.0
- Lyo.Exceptions (>= 1.0.9)
NuGet packages (18)
Showing the top 5 NuGet packages that depend on Lyo.Health:
| Package | Downloads |
|---|---|
|
Lyo.Cache
Cache service abstractions and local IMemoryCache implementation. |
|
|
Lyo.MessageQueue
Message queue service interface and base implementation for asynchronous messaging. |
|
|
Lyo.FileStorage
File storage service interface and base implementation for file operations. |
|
|
Lyo.Authentication.Postgres
PostgreSQL persistence for Lyo.Authentication. Provides EF Core stores for opaque API tokens (`[user].[token]`), Lyo users (`[user].[user]`), and linked external identities (`[user].[linked_identity]`). Schema-owning library — owns the `[user]` schema and the `__EFMigrationsHistory` table inside it. |
|
|
Lyo.Config.Postgres
PostgreSQL implementation of Lyo.Config using Entity Framework Core and jsonb-backed typed values. |
GitHub repositories
This package is not used by any popular GitHub repositories.