Skip to content

Conversation

@jviau
Copy link
Contributor

@jviau jviau commented Nov 3, 2025

Issue describing the changes in this PR

resolves #11461

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

This PR adds a check for AzureWebJobsStorage, which is needed for basic app functionality (the functioning connection). The implementation takes a background-refresh approach. To avoid high latency health check calls, the health will be checked in the background, with the latest value being stored and immediately returned to CheckHealthAsync callers. An exception is the first call, which will block until a health result is available.

This PR also introduces a HealthCheckData type, which is a syntactic sugar wrapper around IReadOnlyDictionary<string, object> (which is what the health checks APIs use). The motivation is to provide a strongly-typed way to enforce a consistent schema for health check data. Having our checks follow a known schema will help automation consume our checks. This wrapper lets us do that via CSharp properties, which can enforce both key and value in one idiomatic way. This is much like HeaderDictionary, which wraps a dictionary but exposes many well-known headers as easy to use properties (that are just part of the dictionary under the hood).

@jviau jviau requested a review from a team as a code owner November 3, 2025 23:53
Copilot AI review requested due to automatic review settings November 3, 2025 23:53
Copy link
Contributor

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 adds a new health check for monitoring connectivity to the AzureWebJobsStorage account used by WebJobs. The health check runs periodically in the background to avoid expensive synchronous connectivity checks during health check requests.

Key changes:

  • Implements WebJobsStorageHealthCheck with background refresh mechanism to cache health check results
  • Adds supporting infrastructure including HealthCheckData helper class for structured health check metadata
  • Refactors HostAzureBlobStorageProvider to extract CreateBlobServiceClient method for improved testability
  • Registers the new health check in the health check pipeline with appropriate tags

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/WebJobs.Script/Diagnostics/HealthChecks/WebJobsStorageHealthCheck.cs New health check implementation with background refresh logic for AzureWebJobsStorage connectivity
src/WebJobs.Script/Diagnostics/HealthChecks/HealthCheckData.cs Helper class for providing structured metadata with health check results
src/WebJobs.Script/Diagnostics/HealthChecks/HealthCheckExtensions.cs Registers the new WebJobsStorageHealthCheck in the health check builder pipeline
src/WebJobs.Script/Diagnostics/HealthChecks/HealthCheckNames.cs Adds constant for WebJobsStorage health check name
src/WebJobs.Script/Diagnostics/HealthChecks/HealthCheckTags.cs Adds WebJobsStorage tag and refactors prefix constants
src/WebJobs.Script/StorageProvider/HostAzureBlobStorageProvider.cs Extracts CreateBlobServiceClient method for improved testability and reusability
test/WebJobs.Script.Tests/Diagnostics/HealthChecks/WebJobsStorageHealthCheckTests.cs Comprehensive test coverage for the new health check implementation
test/WebJobs.Script.Tests/Diagnostics/HealthChecks/HealthCheckExtensionsTests.cs Tests for registration of the new health check

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A good area of discussion for this PR is the names of these properties I have here.

  1. What style should they have? Currently it is pascal case (because it gets the name of the property)
  2. Any names that should be changed?

Copy link
Member

Choose a reason for hiding this comment

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

I think this is fine as is. The only one where I'm like I wish there was a word more descriptive is "Area" but I also can't think of anything

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I bounced around on that naming a few times. I had Source and Cause before. Maybe Category? or ErrorCategory?

@jviau jviau force-pushed the u/jviau/storage-check branch from f7f9504 to 3445c74 Compare November 4, 2025 21:11
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 for AzureWebJobsStorage connection

4 participants