This might be beyond niche, but does #dotnet #aspdotnet health checks libraries have a way to decide *per request* which checks to include?
Either by adding / removing checks when inspecting the request, or by filtering - selecting from a larger set of pre-registered checks?
It's a tenanting thing.
@anthony_steele pretty sure you can inject httpcontextaccesor and other services into your health checks to filter as necessary if that’s what you mean?

@mbrdev
Yes, we do that. But what if based on the tenant, you determine that there are 2 checks to carry out? Or zero.

We currently return 1 HealthCheckResult for all of them, with details of each actual check in the .Data bag.

Is there a better way to this?

@anthony_steele You can map specific endpoints that can filter health checks by tags if you wanted to break it up a bit, one thing to be careful with is to not have a health endpoint return unhealthy for the entire service if only a single tenant is affected as in k8s env that will the pod and spin up a new one when it’s most likely a config problem that a new pod won’t solve. So maybe a generic service health endpoint and then a tenant specific endpoint.