Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 907 Bytes

File metadata and controls

18 lines (14 loc) · 907 Bytes

ClickHouse Health Check

This health check verifies the ability to communicate with ClickHouse. It uses the official ClickHouse.Driver library.

Recommended approach

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");
    });
}