Public documentation
Documentation indexRead as MarkdownClickHouse
Instrument application queries to see client spans. Collect ClickHouse server
metrics through its Prometheus metrics endpoint and the Collector prometheus
receiver. The Contrib 0.160.0 clickhouse exporter writes telemetry into
ClickHouse; it is not a server metrics receiver and is not needed to send data
to Corridora.
Application instrumentation
For an application using a JDBC driver, attach the Java agent and exercise a query through the application. For HTTP/native clients without verified automatic coverage, create a client span around the actual query with your language SDK. Record a stable operation name, server address, and database identity; avoid query literals, credentials, and returned data.
Use the application account's ordinary read permissions for a smoke query such
as SELECT 1. Collector metrics use the dedicated metrics listener and do not
need the application's SQL username or password.
Expose server metrics
For self-managed ClickHouse, add a server configuration fragment through your
normal configuration management, for example in its config.d directory:
<clickhouse>
<prometheus>
<port>9363</port>
<endpoint>/metrics</endpoint>
<metrics>true</metrics>
<asynchronous_metrics>true</asynchronous_metrics>
<events>true</events>
<errors>true</errors>
</prometheus>
</clickhouse>
Apply it using your server's configuration/restart procedure. Restrict the listener to a private monitoring network using bind/network/firewall policy. The simple listener shown here is HTTP and has no credential configuration; do not expose it publicly. For collection across an untrusted network, place it behind an authenticated TLS endpoint and configure matching scrape credentials. ClickHouse Cloud uses its managed Prometheus integration, not this server XML.
Add the scrape pipeline
Merge this partial fragment into common setup. Preserve all
existing pipelines. Requires Contrib's prometheus receiver and resource processor.
The private HTTP scrape is separate from TLS-authenticated OTLP export to Corridora.
receivers:
prometheus/clickhouse:
config:
scrape_configs:
- job_name: clickhouse-server
scrape_interval: 30s
metrics_path: /metrics
static_configs:
- targets: [clickhouse.internal:9363]
processors:
resource/clickhouse:
attributes:
- key: service.name
value: clickhouse-analytics
action: upsert
- key: deployment.environment.name
value: production
action: upsert
service:
pipelines:
metrics/clickhouse:
receivers: [prometheus/clickhouse]
processors: [memory_limiter, resource/clickhouse, batch]
exporters: [otlp_http/corridora]
Assign one scraper per target. Running identical Collector replicas does not automatically distribute Prometheus scraping and can duplicate samples.
Verify
From the Collector network, confirm the endpoint returns text metrics:
curl --fail http://clickhouse.internal:9363/metrics
Record one exposed metric name and its value. Validate/start the Collector and
wait two intervals. Find that metric under clickhouse-analytics in Corridora
Metrics and check the timestamp/target. An up sample alone establishes scrape
status; also check a ClickHouse metric returned by the endpoint.
Run the application's SELECT 1 operation and separately find its client span.
Server metrics, query-log tables, and application spans are different data
sources. The Prometheus pipeline does not export system.query_log or
ClickHouse trace-log records. Use log collection
only for explicitly selected server files.
If metrics are absent, inspect the server's active metrics listener, Collector network access, and scrape errors. If only traces are absent, inspect SDK/client coverage. Finish with verification.
Source basis: ClickHouse Prometheus metrics endpoint documentation, updated 2026-09-14; Prometheus receiver README and component manifest, Contrib 0.160.0. Reviewed 2026-09-28.