For testing purposes, I changed the code line in the aspire template project
from
.AddCheck("self", static () => HealthCheckResult.Healthy(), ["live"]);
to
.AddCheck("self", static () => HealthCheckResult.Unhealthy(), ["live"]);
I wanted to know how this would reflect on the Dashboard. To my surprise, all Services are flagged green. If I call the /health or /alive URL the service returns Unhealthy as expected. So how can the Dashboard not show this?
The only thing I could see that happened is that if I call /alive, I see an error log at the service mentioning that it is called in an unhealthy state.
For testing purposes, I changed the code line in the aspire template project
from
.AddCheck("self", static () => HealthCheckResult.Healthy(), ["live"]);
to
.AddCheck("self", static () => HealthCheckResult.Unhealthy(), ["live"]);
I wanted to know how this would reflect on the Dashboard. To my surprise, all Services are flagged green. If I call the /health or /alive URL the service returns Unhealthy as expected. So how can the Dashboard not show this?
The only thing I could see that happened is that if I call /alive, I see an error log at the service mentioning that it is called in an unhealthy state.
Share Improve this question asked Mar 14 at 11:24 Iaman SwtrseIaman Swtrse 3391 silver badge7 bronze badges 1 |1 Answer
Reset to default 0Sorry,
I totaly fot about this post because I got my answere by the aspire team directly.
The health check shown in aspire does only concern the pots. However you can add the http health checks easy in the Host project. All you have to do is to Change
IResourceBuilder<ProjectResource> weatherService = builder.AddProject<WeatherService>("weatherservice");
to
IResourceBuilder<ProjectResource> weatherService = builder.AddProject<WeatherService>("weatherservice")
.WithHttpsHealthCheck("/health");
Now your service will reflect the health state returned by the /health path too.
MapHealthChecks
calls look like? – Hans Kilian Commented Mar 21 at 9:34