Skip to content

[HealthChecks] Add health check middleware #11173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open

Conversation

jviau
Copy link
Contributor

@jviau jviau commented Jul 9, 2025

Issue describing the changes in this PR

Part of #11010, #11171

Pull request checklist

IMPORTANT: Currently, changes must be backported to the in-proc branch to be included in Core Tools and non-Flex deployments.

  • Backporting to the in-proc branch is not required
    • Otherwise: Link to backporting PR
  • My changes do not require documentation changes
    • Otherwise: Documentation issue linked to PR
  • My changes should not be added to the release notes for the next release
    • Otherwise: I've added my notes to release_notes.md
  • My changes do not need to be backported to a previous version
    • Otherwise: Backport tracked by issue/PR #issue_or_pr
  • My changes do not require diagnostic events changes
    • Otherwise: I have added/updated all related diagnostic events and their documentation (Documentation issue linked to PR)
  • I have added all required tests (Unit tests, E2E tests)

Additional information

Adds supporting files for the eventual addition of a health check endpoint. The added files do two primary things:

  1. HealthCheckWaitMiddleware.cs -- this file enables HTTP long polling of health probes by adding a ?wait={timeInSeconds} query string to the health check calls.
  2. HealthCheckResponseWriter -- this files writes the HTTP responses for health checks. It has 2 modes, a minimal or an expanded response.
    • The expanded response is provided by AspNetCore.Diagnostics.HealthChecks. This ensures it is compatible with other components from that ecosystem of health check packages.
    • Minimal/expanded response is controlled by ?expand={true/false}. Default is false if not included.
    • Note this intentionally does not set status code. That will be done by the AspNetCore health check middleware (which will be added later)

This PR also removes ApiErrorModel (it is unused) and introduces ErrorResponse, which is modeled after the ARM recommended error structure.

@jviau jviau requested a review from a team as a code owner July 9, 2025 18:47
@jviau jviau changed the title Add health check middleware [HealthChecks] Add health check middleware Jul 9, 2025
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