Add standardized ASP.NET health checks to all CHO microservices#475
Merged
aurelianware merged 3 commits intomainfrom Mar 15, 2026
Merged
Add standardized ASP.NET health checks to all CHO microservices#475aurelianware merged 3 commits intomainfrom
aurelianware merged 3 commits intomainfrom
Conversation
- 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
Contributor
There was a problem hiding this comment.
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 viaChoInfrastructureOptions.ConfigureHealthChecks. - Updates multiple services to use
AddChoHealthChecks(...)+MapChoHealthChecks()and adds Infrastructure project references. - Updates Dockerfiles to install
curland addHEALTHCHECKagainsthttp://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/readyuses the default HealthChecks middleware status-code mapping, which returns HTTP 200 forDegraded. Since the Redis and HTTP dependency checks currently returnDegradedon failures, readiness probes can incorrectly succeed while dependencies are down. Consider either (a) configuringHealthCheckOptions.ResultStatusCodesfor/health/readyto mapDegradedto 503, or (b) having dependency checks reportUnhealthywhen 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
to all 21 .NET microservices via CloudHealthOffice.Infrastructure
instruction using /health/live endpoint
Dependency map:
https://claude.ai/code/session_01GuAte3CXXiL3aakyk5uVRn