Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 11, 2025

What does this PR do?

Implements health check support for CouchDb using the MyCouch client library.

Core Implementation:

  • CouchDbHealthCheck - Verifies database connectivity via HeadAsync() with configurable timeout
  • CouchDbOptions - Configuration with connection string and timeout (100ms default)
  • CouchDbConfigure - Validates configuration including connection string presence and timeout range
  • DependencyInjectionExtensions - Registration with default tags ["couchdb", "nosql"]

Key Technical Decisions:

  • Uses Stopwatch for timeout tracking instead of WithTimeoutAsync due to MyCouch API constraints
  • Parses connection string URI to extract server and database for DbConnectionInfo constructor
  • Connection string format: http://server:port/database

Test Coverage:

  • Unit tests: DI extensions, options validation, configuration binding, health check logic
  • Integration tests: TestContainers setup with healthy/degraded/unhealthy scenarios

Example Usage:

// Configuration-based
builder.Services.AddHealthChecks()
    .AddCouchDb("mydb");

// Builder-based
builder.Services.AddHealthChecks()
    .AddCouchDb("mydb", options => {
        options.ConnectionString = "http://localhost:5984/mydb";
        options.Timeout = 5000;
    });

Why is it important?

Enables health monitoring for CouchDb databases in .NET applications, following the established health check pattern used across the repository.

Related issues

  • Closes #[issue_number]

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:

  • analytics.localstack.cloud
    • Triggering command: /opt/code/localstack/.venv/bin/python -m localstack.runtime.main (dns block)
  • api.localstack.cloud
  • assets.localstack.cloud
  • localhost.localstack.cloud
  • s3.localhost.localstack.cloud
  • westus-0.in.applicationinsights.azure.com
    • Triggering command: /home/REDACTED/work/healthchecks/healthchecks/tests/NetEvolve.HealthChecks.Tests.Integration/bin/Debug/net9.0/NetEvolve.HealthChecks.Tests.Integration --internal-msbuild-node /tmp/cf609e6a6b8441d5b1d830a9cd6df35d (dns block)
    • Triggering command: /home/REDACTED/work/healthchecks/healthchecks/tests/NetEvolve.HealthChecks.Tests.Integration/bin/Debug/net8.0/NetEvolve.HealthChecks.Tests.Integration --internal-msbuild-node /tmp/3c282b53f3624098bec8a79a35ecb109 (dns block)

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

Original prompt

This section details on the original issue you should resolve

<issue_title>NetEvolve.HealthChecks.CouchDb</issue_title>
<issue_description>### Project Name

CouchDb

Project Description

Contains HealthChecks for CouchDb, based on the nuget packages MyCouch.

TestContainer Package Required?

Yes

TestContainer Package Name

Testcontainers.CouchDb

Required NuGet Dependencies

MyCouch

Validation Steps

  • Create project structure in src/NetEvolve.HealthChecks.<ProjectName>/
  • Add project to solution (dotnet sln HealthChecks.slnx add)
  • Add project reference to Test projects
  • Add required NuGet packages to Directory.Packages.props
  • Follow naming conventions from ADR decisions
  • Create README.md based on other projects
  • Create unit test folder in tests/NetEvolve.HealthChecks.Tests.Unit/<ProjectName>/
  • Create integration test folder in tests/NetEvolve.HealthChecks.Tests.Integration/<ProjectName>/
  • Add project reference to the solution file
  • Add project reference to existing test projects
  • Add TestContainer package if specified
  • Restore NuGet packages (dotnet restore HealthChecks.slnx)
  • Build the solution (dotnet build HealthChecks.slnx --no-restore)
  • Run tests for the new project (dotnet test HealthChecks.slnx --no-build)
  • Verify all tests pass successfully (>80% coverage recommended)
  • Comment on issue with build/test results
  • Create pull request linking to this issue

Additional Notes

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add CouchDb health checks project structure Add NetEvolve.HealthChecks.CouchDb health check implementation Nov 11, 2025
Copilot finished work on behalf of samtrion November 11, 2025 00:48
Copilot AI requested a review from samtrion November 11, 2025 00:48
@samtrion samtrion force-pushed the copilot/add-couchdb-health-checks branch from 3662206 to add076f Compare November 11, 2025 14:47
@samtrion samtrion force-pushed the copilot/add-couchdb-health-checks branch from add076f to dbe30d3 Compare November 11, 2025 14:50
@samtrion samtrion changed the title Add NetEvolve.HealthChecks.CouchDb health check implementation feat: Add NetEvolve.HealthChecks.CouchDb health check implementation Nov 11, 2025
@samtrion samtrion marked this pull request as ready for review November 11, 2025 18:55
@samtrion samtrion requested a review from a team as a code owner November 11, 2025 18:55
@samtrion samtrion added the type:feature Indicates a new feature or enhancement to be added. label Nov 11, 2025
@codecov
Copy link

codecov bot commented Nov 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (95319df) to head (b637764).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #1069       +/-   ##
==========================================
- Coverage   95.43%       0   -95.44%     
==========================================
  Files         217       0      -217     
  Lines        3678       0     -3678     
  Branches      630       0      -630     
==========================================
- Hits         3510       0     -3510     
+ Misses        120       0      -120     
+ Partials       48       0       -48     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

type:feature Indicates a new feature or enhancement to be added.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NetEvolve.HealthChecks.CouchDb

2 participants