Skip to content

Health check endpoints - #21

Merged
fdaniel02 merged 1 commit into
mainfrom
health-checks
Oct 21, 2026
Merged

fdaniel02 merged 1 commit into
mainfrom
health-checks

Conversation

@fdaniel02

Copy link
Copy Markdown
Owner

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 package
    Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore 10.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.
  • Plain text Healthy / Unhealthy with 200 / 503, no details, since the app is reachable from outside.
  • Telemetry.IsTraced also leaves out /healthz, so probes don't become traces (the check's SQL span is dropped
    with its request).

The probes in cluster-gitops switch to these endpoints in a separate PR once this image is deployed. Kubernetes
readiness will use /healthz/live, not /healthz/ready: with one replica, taking the pod out of the Service during
a 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 200 Healthy. With the database dropped after
    startup (the app can't start without it), live stays 200 and ready returns 503 Unhealthy. The check doesn't
    hang on EF's retries: the test takes about 0.5 s.
  • TelemetryTests: /healthz/* isn't traced.
  • Checked that the test fails when liveness includes the database check.

/healthz/live answers as long as the process runs; /healthz/ready also checks the database. Both are left out of the traces.
@sonarqubecloud

Copy link
Copy Markdown

@fdaniel02
fdaniel02 merged commit 28da2f4 into main Oct 21, 2026
5 checks passed
@fdaniel02
fdaniel02 deleted the health-checks branch October 21, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant