Skip to content

Conversation

jviau
Copy link
Contributor

@jviau jviau commented Sep 19, 2025

Issue describing the changes in this PR

resolves #11171, #11168, #11169, #11010

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 the health check endpoint and registers TelemetryHealthCheckPublisher.

3 endpoints are registered in total:

/runtime/health -> runs all health checks
/runtime/health/live -> runs all health checks with tag azure.functions.liveness -- this will check if the WebHost is alive or not.
/runtime/health/ready -> runs all health checks with tag azure.functions.readiness -- this will check if the ScriptHost is alive or not.

These checks will expand over time.

@jviau jviau requested a review from a team as a code owner September 19, 2025 21:49
@Copilot Copilot AI review requested due to automatic review settings September 19, 2025 21:49
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements health check endpoints for the Azure Functions host, adding telemetry publishing capabilities and proper health check registration. The changes enable monitoring of host lifecycle and readiness states through standardized health check endpoints.

  • Adds health check endpoints at /runtime/health, /runtime/health/live, and /runtime/health/ready
  • Registers telemetry health check publishers for liveness and readiness monitoring
  • Updates metrics configuration to use consistent meter naming and versioning

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
WebJobsApplicationBuilderExtension.cs Adds health check middleware and endpoint configuration with routing for different health check types
HealthCheckExtensions.cs Registers telemetry publishers for liveness and readiness health checks
HostMetrics.cs Adds static version property for consistent meter versioning across health check metrics
HealthCheckMetrics.cs Updates meter creation to use consistent naming and versioning from HostMetrics
HealthCheckExtensionsTests.cs Refactors tests to verify telemetry publisher registration and extracts common verification logic
HostController.cs Removes unused import
FunctionsController.cs Minor comment punctuation fix and removes unused import

@@ -50,10 +50,12 @@ public void AddScriptHostHealthCheck_ThrowsOnNullBuilder()
}

[Fact]
public void AddWebJobsScriptHealthChecks_RegistersBothHealthChecks()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have any tests that verify the new http routes E2E, e.g. similar to the host API tests we have in SamplesEndToEndTests_CSharp

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some tests there.

@@ -0,0 +1,8 @@
{
"version": "2.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

accidental?


PolicyAuthorizationResult authorization = await _policy.AuthorizeAsync(
policy, authentication, context, null).ConfigureAwait(false);
if (!authorization.Succeeded)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super nit: new lines (same for lines 30-31)

Suggested change
if (!authorization.Succeeded)
if (!authorization.Succeeded)

@jviau jviau force-pushed the jviau/health-checks-5 branch from 0740972 to 4b45648 Compare September 19, 2025 23:41
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.

[HealthChecks] Add health check HTTP endpoint
4 participants