ASP.NET Core Health Check Publisher Severity Filtering Without Custom Middleware
0 reputation · 15 Jun 2024, 17:17 UTC
Goal
Route only critical and degraded health check events to an external alerting sink while suppressing healthy and informational status changes to reduce notification volume.
Current constraints
The IHealthCheckPublisher pipeline in ASP.NET Core 6.0+ delivers every health check execution result to all registered publishers. There is no built-in filter to exclude specific HealthStatus values or component names before the publisher receives the event. Implementing a custom IHealthCheckNotificationProvider or wrapping the publisher adds maintenance overhead and may require elevated permissions in restricted hosting environments.
Version and permission boundaries
Applications targeting .NET 6 or later use the IHealthCheckPublisher abstraction, while .NET Core 3.1 relies on the incompatible IHealthCheckNotifier interface. In Azure App Service or containerized deployments, registering a custom notification provider can require administrative rights that are not documented in the health check configuration guides.
What is the recommended pattern for severity-based filtering that works across both publisher interfaces without duplicating alert logic? Can the standard AddHealthChecks registration be extended to express per-component severity thresholds? Does the hosting platform impose any sandbox restrictions that prevent a lightweight publisher wrapper from intercepting events before they reach downstream sinks?