Search code examples
c#.net.net-corehealth-monitoringhealth-check

When would you use filter health checks?


I was reading this article https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/health-checks?view=aspnetcore-3.1#filter-health-checks and couldn't visualize a practical use case for using filter health checks. In a real world situation, when would I use this? Thanks!


Solution

  • In the same page you shared, you can see the following:

    Health probes can be used by container orchestrators and load balancers to check an app's status. For example, a container orchestrator may respond to a failing health check by halting a rolling deployment or restarting a container. A load balancer might react to an unhealthy app by routing traffic away from the failing instance to a healthy instance.

    Use of memory, disk, and other physical server resources can be monitored for healthy status.

    Health checks can test an app's dependencies, such as databases and external service endpoints, to confirm availability and normal functioning.

    As you can see, there are multiple different types of health checks.

    I can see two reasons:

    1. Different reporting purposes
    • Group items for specific monitoring client. One could be a systems division and one a database division
    1. Performance reasons
    • Assesing the health of the database might take time. You might need to raise these during the nighttime, while others every 5 minutes. Filtering will execute the proper ones.