The idea with Health checks is that the application is the best one to know about the state of its components, and how critical each one is. By having the application output its own health information, you don’t need to reinvent the wheel in 3rd party scanners and monitors, trying to do the same type of operations your website does just to make sure everything’s running.

Additionally, health endpoints open up a new world of resilience when used in conjunction with orchestration platforms like Kubernetes, allowing you to build a kind of immune system for your application. Check out the concept of Chaos Engineering from Netflix with a system they call Chaos Monkey https://www.gremlin.com/chaos-monkey/

However, they also provide benefits for teams in earlier stages of automation, but allowing health information from applications and their components to be displayed on a dashboard, or changes in state communicated (ex: via Slack.)

Basic health probe

A health probe is something that checks the health endpoint of a service.

Docker comes with a simple HEALTHCHECK directive that allows you to turn off a faulty container

HEALTHCHECK CMD curl --fail http://localhost:5000/health || exit

It’s also possible to chain health endpoints with other health endpoint, for example if your microservice depends on another microservice that has a health endpoint.

Create health checks

public class ExampleHealthCheck : IHealthCheck
{
public Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default(CancellationToken))
{
var healthCheckResultHealthy = true;
if (healthCheckResultHealthy)
return Task.FromResult(HealthCheckResult.Healthy("A healthy result."));
return Task.FromResult(HealthCheckResult.Unhealthy("An unhealthy result."));
}
}

Source: https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/health-checks?view=aspnetcore-3.0

Health Checks UI


HealthChecksUI provides a great GUI on top of your health checks, when output in a format it expects.

https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks

Health Checks as Azure DevOps Release Gates

https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/blob/master/extensions/README.md


0 Comments
Alexandru Puiu

Engineer / Security Architect

Systems Engineering advocate, Software Engineer, Security Architect / Researcher, SQL/NoSQL DBA, and Certified Scrum Master with a passion for Distributed Systems, AI and IoT..

Expertise

.NET
RavenDB
Kubernetes

Subscribe To My Newsletter

I'll only send worthwhile content I think you'll want, less than once a month, and promise to never spam or sell your information!
Scattered Code
© 2025, All Rights Reserved.

Social Media