Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 25, 2025

The current fundamentals article on Health Checks only covered health check endpoints (/health and /alive) and integration health checks, but was missing documentation for AppHost resource health checks - a key concept for resource orchestration and dependency management in .NET Aspire.

This PR adds a comprehensive new section "AppHost resource health checks" and enhances the overview to clearly distinguish between the two main contexts where health checks operate in .NET Aspire:

  • AppHost resource health checks - Run in the AppHost project to determine resource readiness for orchestration and dependency management
  • Application health check endpoints - Run within individual applications and services to expose monitoring endpoints

The new AppHost resource health checks section covers:

  • Resource readiness determination - How AppHost uses health checks to determine when resources are ready for dependent resources to start
  • HTTP health checks - Using WithHttpHealthCheck() to poll endpoints on containers and project resources
  • Custom health checks - Creating custom health checks with AddHealthChecks().AddCheck() and associating them with resources using WithHealthCheck()
  • WaitFor integration - How these health checks work with the WaitFor API to control startup dependencies
  • Dashboard integration - How health check status appears in the Aspire dashboard, including a screenshot showing the visual representation of health check status

The documentation includes practical code examples matching the patterns described in the issue:

// Custom health check example
builder.Services.AddHealthChecks().AddCheck("mycheck", () =>
{
    return DateTime.Now > startAfter ? HealthCheckResult.Healthy() : HealthCheckResult.Unhealthy();
});

var pg = builder.AddPostgres("pg")
    .WithHealthCheck("mycheck");

builder.AddProject<Projects.MyApp>("myapp")
    .WithReference(pg)
    .WaitFor(pg); // Waits for both the container and custom health check

The enhanced overview section now provides better context by explaining upfront that health checks run in both the AppHost and applications before diving into specific details. All content follows Microsoft Writing Style Guide conventions and passes markdownlint validation.

Fixes #4309.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.


Internal previews

📄 File 🔗 Preview link
docs/fundamentals/health-checks.md docs/fundamentals/health-checks

@Copilot Copilot AI changed the title [WIP] Fundamentals article on health checks needs updating to cover AppHost resource health checks & relationship to WaitFor Add comprehensive AppHost resource health checks documentation to fundamentals Aug 25, 2025
@Copilot Copilot AI requested a review from DamianEdwards August 25, 2025 22:21
Copilot finished work on behalf of DamianEdwards August 25, 2025 22:21
@Copilot Copilot AI requested a review from DamianEdwards August 26, 2025 17:18
Copilot finished work on behalf of DamianEdwards August 26, 2025 17:18
Copy link
Contributor Author

Copilot AI commented Aug 26, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • github-production-user-asset-6210df.s3.amazonaws.com
    • Triggering command: wget -O docs/fundamentals/media/health-checks-dashboard-status.png REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@Copilot Copilot AI changed the title Add comprehensive AppHost resource health checks documentation to fundamentals Add comprehensive AppHost resource health checks documentation with dashboard screenshot Aug 26, 2025
Copilot finished work on behalf of DamianEdwards August 26, 2025 17:47
@Copilot Copilot AI requested a review from DamianEdwards August 26, 2025 17:47
@davidfowl
Copy link
Member

@copilot The overview of this page should mention that health checks run in the app host and in the application before diving into details.

Copy link
Contributor Author

Copilot AI commented Aug 26, 2025

@copilot The overview of this page should mention that health checks run in the app host and in the application before diving into details.

Enhanced the overview section to clarify that health checks operate in two main contexts: AppHost resource health checks for orchestration, and application health check endpoints for individual service monitoring. This provides better context before diving into specific details. (7c4f2a4)

@Copilot Copilot AI changed the title Add comprehensive AppHost resource health checks documentation with dashboard screenshot Add comprehensive AppHost resource health checks documentation with enhanced overview Aug 26, 2025
Copilot finished work on behalf of davidfowl August 26, 2025 17:52
@DamianEdwards DamianEdwards marked this pull request as ready for review August 26, 2025 23:52
@Copilot Copilot AI review requested due to automatic review settings August 26, 2025 23:52
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 adds comprehensive documentation for AppHost resource health checks, addressing a gap in the existing health checks documentation that only covered application-level health check endpoints. The PR enhances the overview to distinguish between two contexts where health checks operate in .NET Aspire and adds detailed coverage of AppHost resource health checks for orchestration and dependency management.

Key changes:

  • Enhanced overview section explaining the two contexts of health checks in .NET Aspire
  • New comprehensive "AppHost resource health checks" section covering resource readiness, HTTP health checks, custom health checks, WaitFor integration, and dashboard integration
  • Practical code examples demonstrating HTTP and custom health check implementations

Copy link
Member

@mitchdenny mitchdenny left a comment

Choose a reason for hiding this comment

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

This looks good. I think it could use an infographic just to really drive home where different health checks are registered and how annotations point from resources to health checks in the AppHost DI container.

Copy link
Contributor Author

Copilot AI commented Aug 27, 2025

This looks good. I think it could use an infographic just to really drive home where different health checks are registered and how annotations point from resources to health checks in the AppHost DI ...

Thank you! An infographic would indeed help clarify the distinction between AppHost health checks and application health check endpoints, and how the resource annotations connect to the AppHost DI container.

I'm unable to create visual diagrams in this environment, but this would follow the same pattern as other diagrams in the repository using Excalidraw. The infographic could visually represent:

  • AppHost project with DI container and registered health checks
  • Resource builder extensions (WithHealthCheck, WithHttpHealthCheck)
  • How these connect to actual health check implementations
  • The relationship with WaitFor dependencies

This would complement the code examples and make the concepts much clearer for developers.

Copilot finished work on behalf of IEvangelist August 27, 2025 13:09
@Copilot Copilot AI requested a review from IEvangelist August 27, 2025 13:09
@IEvangelist IEvangelist merged commit dd5cffe into main Aug 27, 2025
10 checks passed
@IEvangelist IEvangelist deleted the copilot/fix-4309 branch August 27, 2025 14:01
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.

Fundamentals article on health checks needs updating to cover AppHost resource health checks & relationship to WaitFor
5 participants