Skip to content

Improve HealthCheck in Boilerplate (#12299)#12314

Merged
msynk merged 2 commits into
bitfoundation:developfrom
Cyrus-Sushiant:12299-improve-healthcheck
May 10, 2026
Merged

Improve HealthCheck in Boilerplate (#12299)#12314
msynk merged 2 commits into
bitfoundation:developfrom
Cyrus-Sushiant:12299-improve-healthcheck

Conversation

@Cyrus-Sushiant
Copy link
Copy Markdown
Member

@Cyrus-Sushiant Cyrus-Sushiant commented May 7, 2026

closes #12299

Summary by CodeRabbit

Release Notes

  • New Features
    • Extended health check coverage with URL validation for external services
    • Added dedicated monitoring for user profile image storage health status
    • Implemented output caching for health check responses with 10-second expiration
    • Improved health check configuration organization for better service startup management

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 361d32a4-9719-48a7-9134-538d68b2cdc0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

The PR refactors health check implementation to separate storage validation concerns, improve caching behavior, and centralize health check registration. It introduces dependencies for health-check packages, implements UserProfileImagesStorageHealthCheck with domain-specific messaging, creates a new AddServerApiHealthChecks extension method that conditionally registers checks for external services, and configures a 10-second cache expiry policy while explicitly naming the disk storage health check.

Changes

Health Check Refactoring and Cloudflare Cache Integration

Layer / File(s) Summary
Dependency Versions and References
src/Directory.Packages.props, src/Server/Boilerplate.Server.Api/Boilerplate.Server.Api.csproj
Added central NuGet version declarations for AspNetCore.HealthChecks.Uris and AspNetCore.HealthChecks.System (both 9.0.0); added package reference to Uris in the server API project; reordered Hangfire health check entry.
Storage-Specific Health Check
src/Server/Boilerplate.Server.Api/Infrastructure/Services/UserProfileImagesStorageHealthCheck.cs
Implemented UserProfileImagesStorageHealthCheck as IHealthCheck to validate user profile image blob storage with domain-specific health messages instead of generic storage messaging.
Health Check Registration Extension
src/Server/Boilerplate.Server.Api/Program.Services.cs
Extracted health check registration into new AddServerApiHealthChecks extension method; consolidates live checks for database, Hangfire, user profile images storage, and Twilio; conditionally registers Cloudflare and Keycloak URL-group ready checks based on configuration.
Cache Policy and Disk Storage Configuration
src/Server/Boilerplate.Server.Shared/Infrastructure/Extensions/WebApplicationBuilderExtensions.cs
Configured health check output cache policy with 10-second expiry; updated disk storage health check with explicit "binStorage" name while retaining "live" tag.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Health checks now bloom in separate plots,
Profile pics and bins, each knows its spot,
Cloudflare's cache keeps ten seconds true,
Keycloak and CF join the health-check crew,
Storage talks clearly, no generic fuzz,
Refactored and clean—this is what refactor does! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'Improve HealthCheck in Boilerplate' accurately summarizes the main change—enhancing and refactoring the healthcheck implementation in the boilerplate project.
Linked Issues check ✅ Passed The PR addresses all primary objectives from issue #12299: refactored healthcheck with improved storage handling, added storage health checks for profile images, introduced conditional cloudflare/keycloak health checks, and configured output-cache policy for healthcheck responses.
Out of Scope Changes check ✅ Passed All changes are directly scoped to healthcheck improvements as defined in issue #12299; NuGet dependencies for health-check packages and related configuration updates are necessary supporting changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Program.Services.cs`:
- Around line 780-785: The readiness URL checks using
healthChecksBuilder.AddUrlGroup for Cloudflare (with
appSettings.Cloudflare.ZoneId and cloudflareApiToken) and for Keycloak should
set an explicit short HttpClient.Timeout to avoid long hangs; update the
configureClient lambda for the Cloudflare AddUrlGroup to also set client.Timeout
= TimeSpan.FromSeconds(2) (or another small sensible value) when adding the
Authorization header, and add a configureClient for the Keycloak AddUrlGroup
that sets client.Timeout = TimeSpan.FromSeconds(2) as well (and any required
headers), so both URL-based health checks have bounded short timeouts.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 665c06f6-6c44-4149-9ffb-7940d8fdc9bf

📥 Commits

Reviewing files that changed from the base of the PR and between 04a1935 and 9fd4315.

📒 Files selected for processing (5)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Directory.Packages.props
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Boilerplate.Server.Api.csproj
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Infrastructure/Services/UserProfileImagesStorageHealthCheck.cs
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Program.Services.cs
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Shared/Infrastructure/Extensions/WebApplicationBuilderExtensions.cs

@msynk msynk merged commit 51d59dc into bitfoundation:develop May 10, 2026
3 checks passed
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.

Refactor HealthCheck: Improve storage checks and add Cloudflare cache handling

2 participants