Skip to content

Add Expanded Health Check Capability#15019

Open
tekgiant wants to merge 12 commits intomicrosoft:mainfrom
tekgiant:mibir/expanded-health-checks
Open

Add Expanded Health Check Capability#15019
tekgiant wants to merge 12 commits intomicrosoft:mainfrom
tekgiant:mibir/expanded-health-checks

Conversation

@tekgiant
Copy link

@tekgiant tekgiant commented Mar 6, 2026

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15019

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15019"

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Mar 6, 2026
@adamint adamint self-assigned this Mar 6, 2026
@tekgiant
Copy link
Author

tekgiant commented Mar 6, 2026

@tekgiant please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@dotnet-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@dotnet-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@dotnet-policy-service agree company="Microsoft"

Contributor License Agreement

@dotnet-policy-service agree company="Microsoft"

Copy link
Member

@adamint adamint left a comment

Choose a reason for hiding this comment

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

It should go through API review, but I really like this change and only have minimal comments

@tekgiant tekgiant marked this pull request as ready for review March 17, 2026 16:36
Copilot AI review requested due to automatic review settings March 17, 2026 16:36
@tekgiant tekgiant requested a review from adamint March 17, 2026 16:37
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

Adds support for “expanded” HTTP health checks in Aspire by introducing an Aspire-formatted health response writer for services and updating the AppHost-side HTTP health check to parse and surface multiple sub-checks in the dashboard.

Changes:

  • Introduces new Aspire.HealthChecks package with AspireHealthCheckResponseWriter to emit an Aspire-parsable JSON health payload.
  • Updates WithHttpHealthCheck to use a custom AspireHttpHealthCheck that can parse the Aspire health JSON format and attach sub-entries for dashboard expansion.
  • Expands host-side health report merging to fan out sub-entries, and adds new unit/functional tests plus test/playground projects to validate the behavior.

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/testproject/TestProject.HealthCheckService/TestProject.HealthCheckService.csproj Adds a new test service that references Aspire.HealthChecks.
tests/testproject/TestProject.HealthCheckService/Properties/launchSettings.json Launch profile for the new health check test service.
tests/testproject/TestProject.HealthCheckService/Program.cs Implements multiple health checks and maps /health using the Aspire response writer.
tests/testproject/TestProject.AppHost/TestProject.AppHost.csproj References the new health check test service project.
tests/Shared/RepoTesting/Directory.Packages.Helix.props Adds package version pinning for Aspire.HealthChecks in Helix testing.
tests/Aspire.Hosting.Tests/Utils/TestDistributedApplicationBuilder.cs Removes default HTTP client resilience configuration from the test builder.
tests/Aspire.HealthChecks.Tests/AspireHttpHealthCheckUnitTests.cs Adds unit coverage for parsing Aspire-format health JSON into expanded sub-entries.
tests/Aspire.HealthChecks.Tests/AspireHealthCheckFunctionalTests.cs Adds functional tests validating Aspire health JSON output and dashboard expansion behavior.
tests/Aspire.HealthChecks.Tests/Aspire.HealthChecks.Tests.csproj Introduces a dedicated test project for the expanded health checks feature.
src/Aspire.Hosting/ResourceBuilderExtensions.cs Reworks WithHttpHealthCheck to register a custom health check implementation.
src/Aspire.Hosting/Health/ResourceHealthCheckService.cs Expands health report snapshots when a result contains multiple sub-entries.
src/Aspire.Hosting/Health/HealthCheckConstants.cs Defines internal keys/property names used for expanded health check data exchange and parsing.
src/Aspire.Hosting/Health/AspireHttpHealthCheck.cs Adds the HTTP health check implementation that parses Aspire-format health responses.
src/Aspire.Hosting/Aspire.Hosting.csproj Grants internals access to the new Aspire.HealthChecks.Tests assembly.
src/Aspire.HealthChecks/README.md Adds package README describing how to enable expanded health responses.
src/Aspire.HealthChecks/AspireHealthCheckResponseWriter.cs Adds the response writer that emits Aspire-format JSON health results.
src/Aspire.HealthChecks/Aspire.HealthChecks.csproj Introduces the new Aspire.HealthChecks packable library project.
playground/HealthChecks/HealthChecksSandbox.PlainHealthService/Properties/launchSettings.json Adds launch settings for a playground “plain” health service.
playground/HealthChecks/HealthChecksSandbox.PlainHealthService/Program.cs Adds a playground service using default health endpoint behavior (no Aspire writer).
playground/HealthChecks/HealthChecksSandbox.PlainHealthService/HealthChecksSandbox.PlainHealthService.csproj Adds the playground “plain” health service project.
playground/HealthChecks/HealthChecksSandbox.ExpandedHealthService/Properties/launchSettings.json Adds launch settings for a playground “expanded” health service.
playground/HealthChecks/HealthChecksSandbox.ExpandedHealthService/Program.cs Adds a playground service that uses AspireHealthCheckResponseWriter.
playground/HealthChecks/HealthChecksSandbox.ExpandedHealthService/HealthChecksSandbox.ExpandedHealthService.csproj Adds the playground “expanded” health service project and references Aspire.HealthChecks.
playground/HealthChecks/HealthChecksSandbox.AppHost/Program.cs Adds playground scenarios demonstrating keyed, expanded HTTP, and plain HTTP health checks.
playground/HealthChecks/HealthChecksSandbox.AppHost/HealthChecksSandbox.AppHost.csproj References Aspire.HealthChecks and the new playground health service projects.
Aspire.slnx Adds the new library, tests, and playground/testproject projects to the solution.

You can also share your feedback on Copilot code review. Take the survey.

tekgiant and others added 3 commits March 17, 2026 23:10
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Member

@adamint adamint left a comment

Choose a reason for hiding this comment

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

@JamesNK please look

var status = HealthStatus.Unhealthy;
if (entryValue.TryGetProperty(HealthCheckConstants.JsonProperties.Status, out var entryStatusElement))
{
status = Enum.Parse<HealthStatus>(entryStatusElement.GetString()!, ignoreCase: true);
Copy link
Member

Choose a reason for hiding this comment

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

be defensive about type, skip if not string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants