Prognosis 1.0.0-alpha

This is a prerelease version of Prognosis.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Prognosis --version 1.0.0-alpha
                    
NuGet\Install-Package Prognosis -Version 1.0.0-alpha
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Prognosis" Version="1.0.0-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Prognosis" Version="1.0.0-alpha" />
                    
Directory.Packages.props
<PackageReference Include="Prognosis" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Prognosis --version 1.0.0-alpha
                    
#r "nuget: Prognosis, 1.0.0-alpha"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Prognosis@1.0.0-alpha
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Prognosis&version=1.0.0-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Prognosis&version=1.0.0-alpha&prerelease
                    
Install as a Cake Tool

Prognosis

A dependency-aware service health modeling library for .NET. Models the health of multiple services as a directed graph where each service's effective status is computed from its own intrinsic health and the weighted health of its dependencies.

Key concepts

Health statuses

Status Value Meaning
Healthy 0 Known good
Unknown 1 Not yet probed (startup state)
Degraded 2 Known partial failure
Unhealthy 3 Known failure

Ordered worst-is-highest so comparisons naturally surface the most severe status.

Dependency importance

Importance Propagation rule
Required Dependency status passes through unchanged — an unhealthy dependency makes the parent unhealthy
Important Unhealthy is capped at Degraded for the parent; Unknown and Degraded pass through
Optional Dependency health is ignored entirely

Usage patterns

1. Implement IServiceHealth on a class you own

Embed a ServiceHealthTracker and delegate to it:

class DatabaseService : IObservableServiceHealth
{
    private readonly ServiceHealthTracker _health;

    public DatabaseService()
    {
        _health = new ServiceHealthTracker(
            () => IsConnected ? HealthStatus.Healthy : HealthStatus.Unhealthy);
    }

    public bool IsConnected { get; set; } = true;

    public string Name => "Database";
    public IReadOnlyList<ServiceDependency> Dependencies => _health.Dependencies;
    public IObservable<HealthStatus> StatusChanged => _health.StatusChanged;
    public void NotifyChanged() => _health.NotifyChanged();
    public HealthStatus Evaluate() => _health.Evaluate();
}

2. Wrap a service you can't modify

Use DelegatingServiceHealth with a health-check delegate:

var emailHealth = new DelegatingServiceHealth("EmailProvider",
    () => client.IsConnected ? HealthStatus.Healthy : HealthStatus.Unhealthy);

3. Pure composite aggregation

Create virtual aggregation points with no backing service:

var app = new CompositeServiceHealth("Application",
[
    new ServiceDependency(authService, ServiceImportance.Required),
    new ServiceDependency(notifications, ServiceImportance.Important),
]);

Graph operations

// Evaluate a single service (walks its dependencies)
HealthStatus status = app.Evaluate();

// Snapshot the entire graph (depth-first post-order)
IReadOnlyList<ServiceSnapshot> snapshots = HealthAggregator.EvaluateAll(app);

// Package as a serialization-ready report with timestamp
HealthReport report = HealthAggregator.CreateReport(app);

// Detect circular dependencies
IReadOnlyList<IReadOnlyList<string>> cycles = HealthAggregator.DetectCycles(app);

Observable health monitoring

All built-in types implement IObservableServiceHealth. Subscribe to individual services or monitor the full graph:

// Individual service notifications
database.StatusChanged.Subscribe(observer);

// Graph-level polling with HealthMonitor
await using var monitor = new HealthMonitor([app], TimeSpan.FromSeconds(5));
monitor.ReportChanged.Subscribe(reportObserver);

// Manual poll (useful for testing or getting initial state)
monitor.Poll();

IObservable<T> is a BCL type — no System.Reactive dependency required. Add System.Reactive only when you want operators like DistinctUntilChanged() or Throttle().

Serialization

Both enums use [JsonStringEnumConverter] so they serialize as "Healthy" / "Degraded" / etc. The HealthReport and ServiceSnapshot records are designed as wire-friendly DTOs:

{
  "Timestamp": "2026-02-13T18:30:00+00:00",
  "OverallStatus": "Healthy",
  "Services": [
    { "Name": "Database", "Status": "Healthy", "DependencyCount": 0 },
    { "Name": "AuthService", "Status": "Healthy", "DependencyCount": 2 }
  ]
}

Project structure

File Purpose
IServiceHealth.cs Core interface — Name, Dependencies, Evaluate()
IObservableServiceHealth.cs Extends IServiceHealth with StatusChanged and NotifyChanged()
HealthStatus.cs HealthyUnknownDegradedUnhealthy enum
ServiceImportance.cs Required, Important, Optional enum
ServiceDependency.cs Record linking an IServiceHealth with its importance
ServiceHealthTracker.cs Composable helper — embed in any class for dependency tracking, aggregation, and observability
DelegatingServiceHealth.cs Adapter wrapping a Func<HealthStatus> for closed types
CompositeServiceHealth.cs Pure aggregation point with no backing service
HealthAggregator.cs Static helpers — Aggregate, EvaluateAll, CreateReport, DetectCycles
HealthReport.cs Serialization-ready report DTO
ServiceSnapshot.cs Serialization-ready per-service snapshot DTO
HealthMonitor.cs Timer-based poller with IObservable<HealthReport>

Requirements

  • .NET Standard 2.0 or .NET Standard 2.1 compatible runtime (.NET Framework 4.6.1+, .NET Core 2.0+, .NET 5+)
  • System.Text.Json (bundled as a dependency)
  • Microsoft.Bcl.AsyncInterfaces (netstandard2.0 only, bundled as a dependency)
Product 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 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 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 is compatible. 
.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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Prognosis:

Package Downloads
Prognosis.Reactive

System.Reactive extensions for Prognosis. Provides idiomatic Rx operators for polling, merging, and composing health status streams from the Prognosis service health graph.

Prognosis.DependencyInjection

Microsoft.Extensions.DependencyInjection integration for Prognosis. Provides assembly scanning, fluent graph builder, and IHostedService-based health monitoring for the Prognosis service health graph.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
8.0.0 134 8/28/2026
7.0.0-beta.3 3,637 3/9/2026
7.0.0-beta.2 83 3/8/2026
7.0.0-beta.1 77 3/3/2026
7.0.0-alpha 192 3/2/2026
6.1.0 218 3/2/2026
6.0.0 212 3/1/2026
5.0.0 205 2/28/2026
4.1.0 201 2/27/2026
4.0.0 201 2/26/2026
4.0.0-alpha 194 2/26/2026
3.0.1 209 2/19/2026
3.0.0 201 2/19/2026
3.0.0-beta 200 2/18/2026
3.0.0-alpha 205 2/18/2026
2.1.0 203 2/16/2026
2.0.0 205 2/15/2026
1.0.0 212 2/14/2026
1.0.0-alpha 117 2/14/2026