HealthChecks.ClickHouse is a health check for ClickHouse.
$ dotnet add package AspNetCore.HealthChecks.ClickHouseThis health check verifies the ability to communicate with ClickHouse. It uses the ClickHouse.Client library.
When registering the ClickHouse health check, it is recommended to use IHttpClientFactory or a static instance of HttpClient to manage connections.
void Configure(IServiceCollection services)
{
services.AddHttpClient("ClickHouseClient");
services.AddHealthChecks().AddClickHouse(static sp => {
var httpClientFactory = sp.GetRequiredService<IHttpClientFactory>();
return new ClickHouseConnection("Host=ch;Username=default;Password=test;Database=default", httpClientFactory, "ClickHouseClient");
});
}