-
Notifications
You must be signed in to change notification settings - Fork 467
[HealthChecks] Add HealthChecks endpoint, register telemetry publisher #11341
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
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 |
src/WebJobs.Script.WebHost/WebJobsApplicationBuilderExtension.cs
Outdated
Show resolved
Hide resolved
@@ -50,10 +50,12 @@ public void AddScriptHostHealthCheck_ThrowsOnNullBuilder() | |||
} | |||
|
|||
[Fact] | |||
public void AddWebJobsScriptHealthChecks_RegistersBothHealthChecks() |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some tests there.
src/WebJobs.Script.WebHost/WebJobsApplicationBuilderExtension.cs
Outdated
Show resolved
Hide resolved
src/WebJobs.Script.WebHost/host.json
Outdated
@@ -0,0 +1,8 @@ | |||
{ | |||
"version": "2.0", |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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)
if (!authorization.Succeeded) | |
if (!authorization.Succeeded) |
0740972
to
4b45648
Compare
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.in-proc
branch is not requiredrelease_notes.md
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 tagazure.functions.liveness
-- this will check if theWebHost
is alive or not./runtime/health/ready
-> runs all health checks with tagazure.functions.readiness
-- this will check if theScriptHost
is alive or not.These checks will expand over time.