Repository navigation
Health check endpoints - #21
Merged
Merged
Conversation
/healthz/live answers as long as the process runs; /healthz/ready also checks the database. Both are left out of the traces.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



The Kubernetes probes only check that port 8080 is open, and Uptime Kuma (backlog item 32) needs an endpoint that
says whether the app works.
Changes
AddHealthChecks().AddDbContextCheck<AppDbContext>()(new packageMicrosoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore10.0.13, lock files updated)./healthz/live: no checks, only "the process answers". For liveness: a database outage must not restart the pod./healthz/ready: with the database check (EF's "can connect"). For Uptime Kuma and the planned Docker smoke test.Healthy/Unhealthywith 200 / 503, no details, since the app is reachable from outside.Telemetry.IsTracedalso leaves out/healthz, so probes don't become traces (the check's SQL span is droppedwith its request).
The probes in
cluster-gitopsswitch to these endpoints in a separate PR once this image is deployed. Kubernetesreadiness will use
/healthz/live, not/healthz/ready: with one replica, taking the pod out of the Service duringa database outage would only replace the app's own responses with Traefik's "no available server".
Testing
StartupTests(whole app, SQL Server): both endpoints return 200Healthy. With the database dropped afterstartup (the app can't start without it),
livestays 200 andreadyreturns 503Unhealthy. The check doesn'thang on EF's retries: the test takes about 0.5 s.
TelemetryTests:/healthz/*isn't traced.