A lightweight .NET library that provides a standardized schema for exposing service health information. Use this library to make your services compatible with the Simple Observability monitoring dashboard.
Key Features:
- 📊 Standard health metadata schema
- 🚀 Zero-configuration setup
- 🎯 Simple POCO classes
- ✅ Compatible with ASP.NET Core Minimal APIs and MVC
- 🔍 Optional additional metadata support
dotnet add package WorldDomination.SimpleObservabilityAdd a /healthz endpoint to your ASP.NET Core application:
using WorldDomination.SimpleObservability;
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapGet("/healthz", () =>
{
var health = new HealthMetadata
{
ServiceName = "My API Service",
Version = "1.0.0",
Environment = "Production",
Status = HealthStatus.Healthy
};
return Results.Json(health);
});
app.Run();app.MapGet("/healthz", () =>
{
var health = new HealthMetadata
{
ServiceName = "My API Service",
Version = "1.2.3",
Environment = "Production",
Status = HealthStatus.Healthy,
Timestamp = DateTimeOffset.UtcNow,
HostName = Environment.MachineName,
Uptime = TimeSpan.FromHours(24),
Description = "All systems operational",
AdditionalMetadata = new Dictionary<string, string>
{
["Database"] = "Connected",
["Cache"] = "Redis v7.0",
["Region"] = "us-west-2"
}
};
return Results.Json(health);
});HealthStatus.Healthy- Service is operating normally.HealthStatus.Degraded- Service is operational but experiencing issues.HealthStatus.Unhealthy- Service is not operating correctly.
{
"serviceName": "My API Service",
"version": "1.2.3",
"environment": "Production",
"status": "Healthy",
"timestamp": "2024-01-15T10:30:00Z",
"hostName": "server-01",
"uptime": "1.00:00:00",
"description": "All systems operational",
"additionalMetadata": {
"database": "Connected",
"cache": "Redis v7.0",
"region": "us-west-2"
}
}Contributions are welcome! Please feel free to submit a Pull Request.
See LICENSE for details.