Advertisement
Advanced ASP.NET Core, Health Checks

How would you integrate health check results with the AspNetCore.HealthChecks.UI package to get a persistent, historical dashboard view of health status over time?

Short answer

The HealthChecks.UI package adds a separate web dashboard (typically at /healthchecks-ui) that periodically polls one or more configured health check endpoints, storing historical results and displaying status trends over time (not just the current instantaneous status), plus…

Save ASP.NET Core mock interview
Advertisement
AModel answer
The HealthChecks.UI package adds a separate web dashboard (typically at /healthchecks-ui) that periodically polls one or more configured health check endpoints, storing historical results and displaying status trends over time (not just the current instantaneous status), plus configurable webhook notifications when status changes -- valuable for spotting intermittent or recurring health issues that a single point-in-time check wouldn't reveal.
// Program.cs
builder.Services.AddHealthChecksUI(options => {
    options.AddHealthCheckEndpoint("API", "/health");
}).AddInMemoryStorage();

var app = builder.Build();
app.MapHealthChecks("/health", new HealthCheckOptions { Predicate = _ => true, ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse });
app.MapHealthChecksUI(options => options.UIPath = "/healthchecks-ui");
Real-world example
An operations team deploys the HealthChecks.UI dashboard polling their API's /health endpoint every 30 seconds, quickly noticing a pattern where the Redis check intermittently degrades every night during a scheduled backup job -- a pattern invisible from a single current-status check alone.
Likely follow-ups
  • What's the trade-off of in-memory storage versus a persistent database backend for the UI's historical data?
  • How would you configure webhook notifications to alert a team channel when status changes?
Related topics