Closed rynowak closed 5 years ago
Hi @rynowak ,
Thank you for your efforts. We really need this kind of check.
We are implementing a healthCheck in our services and we will certainly replace it with the official .Net Core healthCheck but we have a need to customize the return json object.
Is should be useful to have a second Func parameter in which we can return a response based on the CompositeHealthCheckResult. Something like:
.UseHealthChecks("/HealthCheck", cr =>
{
var healthCheckResults = cr.Results.Where(r => r.Value is IHealthCheckResult);
return new
{
status = cr.CheckStatus.ToString(),
details = healthCheckResults.Select(r => new { scope = r.Key, message = r.Value.Description, status = r.Value.CheckStatus.ToString() })
};
});
@youssefNettuno I think you can do at least part of that with a HealthCheck ResponseWriter
@unaizorrilla - do you have any concerns if we go back to individual health checks returning healthy/degraded/unhealthy? I still want to retain a way for the app author to specify what the health check should return. I'll have a proposal soon.
Hi @rynowak - nope, let me known when you have the proposal.
Done!
What's the new proposal or solution? Is it doc'd or what's the store?
Oops sorry the PR didn't get linked here: https://github.com/aspnet/Diagnostics/pull/520
It's pretty similar to what you saw in preview2. For an app author, return whatever status you want in custom checks.
The guidance for libraries is to use context.Registration.FailureStatus
to respect what the user configurated.
+1
I'm still not totally happy with the design of health status. We should review this again and see if it's meeting all of our goals.
Design points:
Failed
and what it doeshttps://github.com/aspnet/Diagnostics/pull/479#issuecomment-432478080