Akka.HealthCheck.Hosting.Web
1.5.37
Prefix Reserved
See https://petabridge.com/blog/you-dont-need-akka-healthchecks-anymore/ - all of the functionality from Akka.HealthChecks is now built-in to Akka.Hosting, with fewer bugs and configuration overhead.
dotnet add package Akka.HealthCheck.Hosting.Web --version 1.5.37
NuGet\Install-Package Akka.HealthCheck.Hosting.Web -Version 1.5.37
<PackageReference Include="Akka.HealthCheck.Hosting.Web" Version="1.5.37" />
<PackageVersion Include="Akka.HealthCheck.Hosting.Web" Version="1.5.37" />
<PackageReference Include="Akka.HealthCheck.Hosting.Web" />
paket add Akka.HealthCheck.Hosting.Web --version 1.5.37
#r "nuget: Akka.HealthCheck.Hosting.Web, 1.5.37"
#:package Akka.HealthCheck.Hosting.Web@1.5.37
#addin nuget:?package=Akka.HealthCheck.Hosting.Web&version=1.5.37
#tool nuget:?package=Akka.HealthCheck.Hosting.Web&version=1.5.37
Akka.HealthCheck.Hosting.Web
This package integrates Akka.HealthCheck, Akka.Hosting, and Microsoft.AspNetCore.Diagnostics.HealthChecks, allowing users to access Akka.HealthCheck via HTTP REST API.
Available Akka.NET Probes
The package provides 5 IHealthCheck probes that can be registered with the health check middleware, each uniquely tagged so they can be individually filtered during mapping:
AkkaReadinessProbe- The default readiness probe. The probe reports the time theActorSystemwas started.Tags: [ "akka", "ready", "node" ]
AkkaLivenessProbe- The default liveness probe. The probe reports the time theActorSystemwas started.Tags: [ "akka", "live", "node" ]
AkkaClusterReadinessProbe- Readiness probe for clustering.- Reports healthy when:
- The
ActorSystemjoined a cluster. - The
ActorSystemis connected to a cluster
- The
- Reports unhealthy when:
- The
ActorSystemjust started has not joined a cluster. - All other nodes in the cluster is unreachable.
- The
Tags: [ "akka", "ready", "cluster" ]
- Reports healthy when:
AkkaClusterLivenessProbe- Liveness probe for clustering.- Reports healthy when:
- The
ActorSystemjoined a cluster. - The
ActorSystemis connected to a cluster
- The
- Reports unhealthy when:
- The
ActorSystemjust started and has not joined a cluster. - The
ActorSystemleft the cluster.
- The
Tags: [ "akka", "live", "cluster" ]
- Reports healthy when:
AkkaPersistenceLivenessProbe- Liveness probe for persistence. It probes the persistence storage every second to check that persistence is working properly.- Reports healthy when persistence successfully recover both journal and snapshot data from storage.
- Reports unhealthy when:
- Persistence just started and has not recovered.
- Either journal or snapshot failed recovery inside the periodic check.
Tags: [ "akka", "live", "persistence" ]
Installation
There are 3 steps that needs to be done to integrate Akka.HealthCheck with diagnostic health check
- Register health check probes to the health check middleware service.
- Add
Akka.HealthCheckto theActorSystem. - Map the health check probe routes.
Register Akka.HealthCheck Services With HealthCheck
The convenience IServiceCollection extension method WithAkkaHealthCheck(HealthCheckType) can be used to register the standard probes in any combination.
var webBuilder = WebApplication.CreateBuilder(args);
webBuilder.Services
.WithAkkaHealthCheck(HealthCheckType.All);
As alternative, individual probes can be registered using these methods:
WithAkkaLivenessProbe()WithAkkaReadinessProbe()WithAkkaClusterLivenessProbe()WithAkkaClusterReadinessProbe()WithAkkaPersistenceLivenessProbe()
Add Akka.HealthCheck To The ActorSystem
The convenience AkkaConfigurationBuilder extension method WithWebHealthCheck(IServiceProvider) automatically scans for any registered probes inside the health check middleware and adds the respective Akka.NET health check probes to the ActorSystem
var webBuilder = WebApplication.CreateBuilder(args);
webBuilder.Services
.WithAkkaHealthCheck(HealthCheckType.All)
.AddAkka("actor-system", (builder, serviceProvider) =>
{
// Automatically detects which health checks were registered
// inside the health check middleware and starts them
builder.WithWebHealthCheck(serviceProvider);
});
Map The Health Check Probe Routes
The convenience IEndpointRouteBuilder extension method MapAkkaHealthCheckRoutes automatically scans for any registered probes inside the health check middleware and maps all the probes to a HTTP route. The HTTP route is the concatenation of the probe tags. By default:
AkkaReadinessProbeis mapped to "/{prefix}/akka/ready/node"AkkaLivenessProbeis mapped to "/{prefix}/akka/live/node"AkkaClusterReadinessProbeis mapped to "/{prefix}/akka/ready/cluster"AkkaClusterLivenessProbeis mapped to "/{prefix}/akka/live/cluster"AkkaPersistenceLivenessProbeis mapped to "/{prefix}/akka/live/persistence"- All liveness probes can be queried all at once at "/{prefix}/akka/live"
- All readiness probes can be queried all at once at "/{prefix}/akka/ready"
- All Akka.NET probes can be queried all at once at ""/{prefix}/akka"
var webBuilder = WebApplication.CreateBuilder(args);
webBuilder.Services
// Register all of the health check service with IServiceCollection
.WithAkkaHealthCheck(HealthCheckType.All)
.AddAkka("actor-system", (builder, serviceProvider) =>
{
builder
// Automatically detects which health checks were registered
// inside the health check middleware and starts them
.WithWebHealthCheck(serviceProvider);
});
var app = webBuilder.Build();
// Automatically detects which health checks were registered inside
// the health check middleware and maps their routes
app.MapAkkaHealthCheckRoutes();
await app.RunAsync();
HTTP Response
By default, the health check middleware outputs a simple string response of either "healthy" or "unhealthy" regardless of the number of probes being queried. To more verbose response can be gained by using Helper.JsonResponseWriter as the route endpoint response writer.
app.MapAkkaHealthCheckRoutes(
optionConfigure: opt =>
{
// Use a custom response writer to output a json of all reported statuses
opt.ResponseWriter = Helper.JsonResponseWriter;
});
Example output when all probes are enabled:
{
"status": "Healthy",
"results": {
"akka-liveness": {
"status": "Healthy",
"description": "Akka.NET node is alive",
"data": {
"message": "Live: 12/16/2022 9:54:28 PM +00:00"
}
},
"akka-readiness": {
"status": "Healthy",
"description": "Akka.NET node is ready",
"data": {
"message": "Live: 12/16/2022 9:54:28 PM +00:00"
}
},
"akka-cluster-liveness": {
"status": "Healthy",
"description": "Akka.NET cluster is alive",
"data": {
"message": ""
}
},
"akka-cluster-readiness": {
"status": "Healthy",
"description": "Akka.NET cluster is ready",
"data": {
"message": ""
}
},
"akka-persistence-liveness": {
"status": "Healthy",
"description": "Akka.NET persistence is alive",
"data": {
"message": "RecoveryStatus(JournalRecovered=True, SnapshotRecovered=True)"
}
}
}
}
Manually Setup Custom Akka.NET IProbeProvider With Health Check Middleware
To manually setup a custom IProbeProvider, check the custom probe example project.
Documentation on how to set up ASP.NET Core health check can be read here
| 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 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 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. |
| .NET Core | netcoreapp3.1 is compatible. |
-
.NETCoreApp 3.1
- Akka.HealthCheck.Hosting (>= 1.5.37)
-
net6.0
- Akka.HealthCheck.Hosting (>= 1.5.37)
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 | |
|---|---|---|---|
| 1.5.37 | 71,551 | 1/23/2025 | |
| 1.5.35 | 3,825 | 1/20/2025 | |
| 1.5.31 | 12,228 | 11/27/2024 | |
| 1.5.26.1 | 168,194 | 7/18/2024 | |
| 1.5.26 | 1,792 | 7/15/2024 | |
| 1.5.24 | 7,130 | 6/11/2024 | |
| 1.5.18 | 17,767 | 3/25/2024 | |
| 1.5.17.1 | 3,142 | 3/4/2024 | |
| 1.5.16 | 3,299 | 2/23/2024 | |
| 1.5.12 | 27,935 | 9/11/2023 | |
| 1.5.9 | 4,548 | 7/24/2023 | |
| 1.5.2 | 21,703 | 4/19/2023 | |
| 1.5.0.1 | 5,639 | 3/8/2023 | |
| 1.5.0 | 644 | 3/3/2023 | |
| 1.0.0 | 1,667 | 1/18/2023 | |
| 1.0.0-beta1 | 665 | 1/5/2023 |
[Bump Akka version to 1.5.37](https://github.com/akkadotnet/akka.net/releases/tag/1.5.37)
[Bump Akka.Hosting to 1.5.37](https://github.com/akkadotnet/Akka.Hosting/releases/tag/1.5.37)