Performance and errors monitoring


You can monitor DB performance and errors using distributed tracingopen in new window and metricsopen in new window. Tracing allows you to see how a request progresses through different services and systems, timings of every operation, any logs and errors as they occur.

go-clickhouse supports tracing and metrics using OpenTelemetry API. OpenTelemetry is a vendor-neutral API for distributed traces and metrics. It specifies how to collect and send telemetry data to backend platforms. It means that you can instrument your application once and then add or change vendors (backends) as required.

go-clickhouse comes with an OpenTelemetry instrumentation called chotelopen in new window that is distributed as a separate module:

go get

To instrument go-clickhouse database, you need to add the hook provided by chotel:

import (

db := ch.Connect(ch.WithDatabase("test"))

As expected, go-clickhouse creates spansopen in new window for processed queries and records any errors as they occur. Here is how the collected information is displayed at Uptraceopen in new window:

clickhouse trace

You can find a runnable example at GitHubopen in new window.