This health check verifies the ability to communicate with ClickHouse. It uses the official ClickHouse.Driver 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");
});
}