Skip to content

Add standardized ASP.NET health checks to all CHO microservices#475

Merged
aurelianware merged 3 commits intomainfrom
claude/add-health-checks-BIJt1
Mar 15, 2026
Merged

Add standardized ASP.NET health checks to all CHO microservices#475
aurelianware merged 3 commits intomainfrom
claude/add-health-checks-BIJt1

Conversation

@aurelianware
Copy link
Owner

  • Update HealthCheckExtensions to use /health/live and /health/ready paths
  • Add AddChoHealthChecks() with MongoDB, Redis, and HTTP dependency checks
    to all 21 .NET microservices via CloudHealthOffice.Infrastructure
  • Add Infrastructure project reference to all service .csproj files
  • Update all Dockerfiles to repo-root build context with HEALTHCHECK
    instruction using /health/live endpoint
  • Add ChoInfrastructureOptions.ConfigureHealthChecks for custom checks
  • Add health-check-dependency-matrix.md documenting all service checks

Dependency map:

  • claims-service: MongoDB
  • benefit-plan-service: MongoDB, Redis, claims-service HTTP
  • payment-service: MongoDB, claims-service HTTP
  • reference-data-service: PostgreSQL (NpgSql)
  • All others: MongoDB

https://claude.ai/code/session_01GuAte3CXXiL3aakyk5uVRn

- Update HealthCheckExtensions to use /health/live and /health/ready paths
- Add AddChoHealthChecks() with MongoDB, Redis, and HTTP dependency checks
  to all 21 .NET microservices via CloudHealthOffice.Infrastructure
- Add Infrastructure project reference to all service .csproj files
- Update all Dockerfiles to repo-root build context with HEALTHCHECK
  instruction using /health/live endpoint
- Add ChoInfrastructureOptions.ConfigureHealthChecks for custom checks
- Add health-check-dependency-matrix.md documenting all service checks

Dependency map:
  - claims-service: MongoDB
  - benefit-plan-service: MongoDB, Redis, claims-service HTTP
  - payment-service: MongoDB, claims-service HTTP
  - reference-data-service: PostgreSQL (NpgSql)
  - All others: MongoDB

https://claude.ai/code/session_01GuAte3CXXiL3aakyk5uVRn
Copilot AI review requested due to automatic review settings March 15, 2026 19:38
@github-actions github-actions bot added documentation Improvements or additions to documentation github-config size/L labels Mar 15, 2026
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

Standardizes ASP.NET Core health checks across Cloud Health Office microservices by centralizing registration/mapping in CloudHealthOffice.Infrastructure, aligning container probes to /health/live and /health/ready, and updating service Dockerfiles to run liveness HEALTHCHECKs against the new endpoint.

Changes:

  • Introduces/updates shared Infrastructure health-check wiring (AddChoHealthChecks, MapChoHealthChecks) and allows additional per-service health-check customization via ChoInfrastructureOptions.ConfigureHealthChecks.
  • Updates multiple services to use AddChoHealthChecks(...) + MapChoHealthChecks() and adds Infrastructure project references.
  • Updates Dockerfiles to install curl and add HEALTHCHECK against http://localhost:8080/health/live, plus adjusts build steps to use repo-root paths.

Reviewed changes

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

Show a summary per file
File Description
src/services/trading-partner-service/trading-partner-service.csproj Adds Infrastructure project reference.
src/services/trading-partner-service/Program.cs Switches to standardized CHO health checks + maps standard endpoints.
src/services/trading-partner-service/Dockerfile Moves to repo-root COPY pattern, adds curl + liveness HEALTHCHECK.
src/services/tenant-service/TenantService.csproj Adds Infrastructure project reference.
src/services/tenant-service/Program.cs Switches to standardized CHO health checks + maps standard endpoints.
src/services/tenant-service/Dockerfile Updates build/publish flow and adds liveness HEALTHCHECK.
src/services/sponsor-service/sponsor-service.csproj Adds Infrastructure project reference.
src/services/sponsor-service/Program.cs Switches to standardized CHO health checks + maps standard endpoints.
src/services/sponsor-service/Dockerfile Updates build/publish flow and adds curl + liveness HEALTHCHECK.
src/services/smart-auth-service/smart-auth-service.csproj Adds Infrastructure project reference.
src/services/smart-auth-service/Program.cs Switches to standardized CHO health checks + maps standard endpoints.
src/services/smart-auth-service/Dockerfile Updates build/publish flow and adds curl + liveness HEALTHCHECK.
src/services/shared/CloudHealthOffice.Infrastructure/HealthChecks/HealthCheckExtensions.cs Changes health-check routes to /health/live and /health/ready.
src/services/shared/CloudHealthOffice.Infrastructure/Extensions/ServiceCollectionExtensions.cs Adds ConfigureHealthChecks hook for custom checks.
src/services/risk-adjustment-service/risk-adjustment-service.csproj Adds Infrastructure project reference.
src/services/risk-adjustment-service/Program.cs Switches to standardized CHO health checks + maps standard endpoints.
src/services/risk-adjustment-service/Dockerfile Updates build/publish flow and adds curl + liveness HEALTHCHECK.
src/services/rfai-service/rfai-service.csproj Adds Infrastructure project reference.
src/services/rfai-service/Program.cs Switches to standardized CHO health checks + maps standard endpoints.
src/services/rfai-service/Dockerfile Updates build/publish flow and adds curl + liveness HEALTHCHECK.
src/services/reference-data-service/reference-data-service.csproj Adds Infrastructure project reference.
src/services/reference-data-service/Program.cs Switches to standardized CHO health checks + adds PostgreSQL readiness check.
src/services/reference-data-service/Dockerfile Updates build/publish flow and adds curl + liveness HEALTHCHECK.
src/services/provider-service/provider-service.csproj Adds Infrastructure project reference.
src/services/provider-service/Program.cs Switches to standardized CHO health checks + maps standard endpoints.
src/services/provider-service/Dockerfile Updates build/publish flow and adds curl + liveness HEALTHCHECK.
src/services/premium-billing-service/premium-billing-service.csproj Adds Infrastructure project reference.
src/services/premium-billing-service/Program.cs Switches to standardized CHO health checks + maps standard endpoints.
src/services/premium-billing-service/Dockerfile Updates build/publish flow and updates HEALTHCHECK to /health/live.
src/services/payment-service/payment-service.csproj Adds Infrastructure project reference.
src/services/payment-service/Program.cs Adds CHO health checks incl. HTTP dependency to claims-service + maps endpoints.
src/services/payment-service/Dockerfile Updates build/publish flow and updates HEALTHCHECK to /health/live.
src/services/member-service/member-service.csproj Adds Infrastructure project reference.
src/services/member-service/Program.cs Switches to standardized CHO health checks + maps standard endpoints.
src/services/member-service/Dockerfile Updates build/publish flow and adds curl + liveness HEALTHCHECK.
src/services/fhir-service/fhir-service.csproj Adds Infrastructure project reference.
src/services/fhir-service/Program.cs Switches to standardized CHO health checks + maps standard endpoints.
src/services/fhir-service/Dockerfile Updates build/publish flow and adds curl + liveness HEALTHCHECK.
src/services/enrollment-import-service/Program.cs Replaces ad-hoc /health//ready endpoints with standard CHO health checks.
src/services/enrollment-import-service/EnrollmentImportService.csproj Adds Infrastructure project reference.
src/services/enrollment-import-service/Dockerfile Updates build/publish flow and adds curl + liveness HEALTHCHECK.
src/services/encounter-service/encounter-service.csproj Adds Infrastructure project reference.
src/services/encounter-service/Program.cs Switches to standardized CHO health checks + maps standard endpoints.
src/services/encounter-service/Dockerfile Updates build/publish flow and adds curl + liveness HEALTHCHECK.
src/services/eligibility-service/eligibility-service.csproj Adds Infrastructure project reference.
src/services/eligibility-service/Program.cs Switches to standardized CHO health checks + maps standard endpoints.
src/services/eligibility-service/Dockerfile Updates build/publish flow and adds curl + liveness HEALTHCHECK.
src/services/coverage-service/coverage-service.csproj Adds Infrastructure project reference.
src/services/coverage-service/Program.cs Switches to standardized CHO health checks + maps standard endpoints.
src/services/coverage-service/Dockerfile Updates build/publish flow and adds curl + liveness HEALTHCHECK.
src/services/claims-service/Dockerfile Adds liveness HEALTHCHECK to /health/live.
src/services/benefit-plan-service/benefit-plan-service.csproj Adds Infrastructure project reference.
src/services/benefit-plan-service/Program.cs Adds CHO health checks incl. Redis + HTTP dependency to claims-service + maps endpoints.
src/services/benefit-plan-service/Dockerfile Adds Infrastructure COPYs and liveness HEALTHCHECK to /health/live.
src/services/authorization-service/authorization-service.csproj Adds Infrastructure project reference.
src/services/authorization-service/Program.cs Switches to standardized CHO health checks + maps standard endpoints.
src/services/authorization-service/Dockerfile Updates build/publish flow and adds curl + liveness HEALTHCHECK.
src/services/attachment-service/attachment-service.csproj Adds Infrastructure project reference.
src/services/attachment-service/Program.cs Replaces ad-hoc health endpoint with standard CHO health checks.
src/services/attachment-service/Dockerfile Adds Infrastructure COPYs and liveness HEALTHCHECK to /health/live.
src/services/appeals-service/appeals-service.csproj Adds Infrastructure project reference.
src/services/appeals-service/Program.cs Switches to standardized CHO health checks + maps standard endpoints.
src/services/appeals-service/Dockerfile Updates build/publish flow and updates HEALTHCHECK to /health/live.
docs/health-check-dependency-matrix.md Documents standardized endpoints and per-service dependency checks.
Comments suppressed due to low confidence (1)

src/services/shared/CloudHealthOffice.Infrastructure/HealthChecks/HealthCheckExtensions.cs:70

  • /health/ready uses the default HealthChecks middleware status-code mapping, which returns HTTP 200 for Degraded. Since the Redis and HTTP dependency checks currently return Degraded on failures, readiness probes can incorrectly succeed while dependencies are down. Consider either (a) configuring HealthCheckOptions.ResultStatusCodes for /health/ready to map Degraded to 503, or (b) having dependency checks report Unhealthy when unreachable so readiness fails as intended.

Comment on lines +36 to +40
// Health checks (MongoDB)
builder.Services.AddChoHealthChecks(options =>
{
options.MongoDbConnectionString = builder.Configuration["MongoDb:ConnectionString"];
});
Comment on lines +68 to +72
// Health checks (MongoDB)
builder.Services.AddChoHealthChecks(options =>
{
options.MongoDbConnectionString = builder.Configuration["MongoDb:ConnectionString"];
});
Comment on lines +79 to +82
builder.Services.AddChoHealthChecks(options =>
{
options.MongoDbConnectionString = builder.Configuration["MongoDb:ConnectionString"];
});
Comment on lines +82 to +85
builder.Services.AddChoHealthChecks(options =>
{
options.MongoDbConnectionString = builder.Configuration["MongoDb:ConnectionString"];
});
Comment on lines 1 to +12
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
WORKDIR /repo

# Copy csproj and restore dependencies
COPY ["payment-service.csproj", "./"]
RUN dotnet restore "payment-service.csproj"
# Copy csproj files and restore (preserves layer caching)
COPY src/services/payment-service/payment-service.csproj src/services/payment-service/
COPY src/services/shared/CloudHealthOffice.Infrastructure/CloudHealthOffice.Infrastructure.csproj src/services/shared/CloudHealthOffice.Infrastructure/
RUN dotnet restore src/services/payment-service/payment-service.csproj

# Copy everything else and build
COPY . .
RUN dotnet build "payment-service.csproj" -c Release -o /app/build
# Copy source code and build
COPY src/services/payment-service/ src/services/payment-service/
COPY src/services/shared/CloudHealthOffice.Infrastructure/ src/services/shared/CloudHealthOffice.Infrastructure/
RUN dotnet build src/services/payment-service/payment-service.csproj -c Release --no-restore
Comment on lines 50 to 62
/// <summary>
/// Maps standard Cloud Health Office health check endpoints: /health (all), /live (liveness), /ready (readiness).
/// </summary>
public static IApplicationBuilder MapChoHealthChecks(this IApplicationBuilder app)
{
app.UseHealthChecks("/health", new HealthCheckOptions
{
ResponseWriter = WriteHealthCheckResponse
});

app.UseHealthChecks("/live", new HealthCheckOptions
app.UseHealthChecks("/health/live", new HealthCheckOptions
{
Predicate = check => check.Tags.Contains("live"),
Comment on lines +65 to +69
// Health checks (MongoDB)
builder.Services.AddChoHealthChecks(options =>
{
options.MongoDbConnectionString = builder.Configuration["MongoDb:ConnectionString"];
});
- Add CosmosDbHealthCheck for services running in Cosmos DB mode
- Add CosmosDbConnectionString/Endpoint/Key to ChoHealthCheckOptions
- Update all 17 dual-database services to configure both MongoDB and
  Cosmos DB health checks (auto-detects active datastore at runtime)
- Fix XML docs to reference /health/live and /health/ready (not /live, /ready)
- Fix docker-compose.yml build contexts to use repo root (required by
  Dockerfiles that reference the Infrastructure project)
- Update docker-compose healthcheck to use /health/live
- Update dependency matrix doc with Cosmos DB column

https://claude.ai/code/session_01GuAte3CXXiL3aakyk5uVRn
All .NET service Dockerfiles now use repo-root-relative paths (e.g.
COPY src/services/X/...) to include the shared CloudHealthOffice.Infrastructure
project. The workflow defaulted to service-directory context which caused
"not found" errors for member-service, coverage-service, enrollment-import-service,
and all other .NET services without explicit build_context overrides.

Changes:
- Default build context changed from ./src/services/{service} to '.'
- Removed per-service build_context overrides (no longer needed)
- Added claims-scrubbing-service override to keep service-local context (Node.js)
- Added tenant-service, benefit-plan-service, payment-service to matrix
  (previously only existed as include entries or were missing)

https://claude.ai/code/session_01GuAte3CXXiL3aakyk5uVRn
@github-actions github-actions bot added the ci/cd label Mar 15, 2026
@github-actions
Copy link

Code Coverage

Package Line Rate Branch Rate Health
CloudHealthOffice.Portal 3% 4%
CloudHealthOffice.Portal 3% 4%
Summary 3% (390 / 12126) 4% (96 / 2604)

@aurelianware aurelianware merged commit 1ebfa37 into main Mar 15, 2026
59 checks passed
@aurelianware aurelianware deleted the claude/add-health-checks-BIJt1 branch March 15, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants