Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ClickHouse HealthCheck support #2315

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

smbecker
Copy link

What this PR does / why we need it: Adds health check support for ClickHouse

Does this PR introduce a user-facing change?: It adds a new package to support ClickHouse health checks

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Unit tests passing
  • End-to-end tests passing
  • Extended the documentation
  • Provided sample for the feature

@github-actions github-actions bot added github_actions Pull requests that update Github_actions code docs labels Nov 11, 2024
Copy link
Collaborator

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

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

@smbecker big thanks for your contribution! It looks like a step in the right direction, we just need to clarify how ClickHouseConnection should be used to ensure we provide the right API and of course solve the copy-paste errors.

src/HealthChecks.ClickHouse/README.md Show resolved Hide resolved
{
try
{
await using var connection = _options.ConnectionFactory?.Invoke() ?? new ClickHouseConnection(_options.ConnectionString);
Copy link
Collaborator

Choose a reason for hiding this comment

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

What are the recommendations for using ClickHouseConnection? Namely:

  • is it thread safe?
  • does it have a built-in pool of connections? (when we execute new ClickHouseConnection(_options.ConnectionString), does it always create a new coonection?)

I need to get a better understanding of how it should be used before I approve the shape of the public API for this DB.

Copy link
Author

Choose a reason for hiding this comment

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

is it thread safe?

Looking at the code, instance methods on ClickHouseConnection do not appear to be thread-safe. However, commands do appear to be thread-safe in that they just execute HttpRequestMessages against the owned HttpClient.

does it have a built-in pool of connections?

It does not support pooling directly. However, when creating a ClickHouseConnection with a passed in HttpClient or IHttpClientFactory, you can take advantage of pooling within the HttpClient.

I could follow a similar pattern to Npgsql if/when this PR is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs github_actions Pull requests that update Github_actions code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants