Skip to main content

ClickHouse Exporter

Export OpenTelemetry to ClickHouse.

Telemetry TypeSupport
Traces✅
Logs✅
Metrics✅

The ClickHouse exporter can be selected by passing --exporter clickhouse. The ClickHouse exporter has full support for traces, logs, and metrics.

OptionDefaultOptions
--clickhouse-exporter-endpoint
--clickhouse-exporter-databaseotel
--clickhouse-exporter-table-prefixotel
--clickhouse-exporter-compressionlz4none, lz4
--clickhouse-exporter-async-inserttruetrue, false
--clickhouse-exporter-request-timeout5s
--clickhouse-exporter-enable-json
--clickhouse-exporter-json-underscore
--clickhouse-exporter-user
--clickhouse-exporter-password
--clickhouse-exporter-retry-initial-backoff(uses global exporter default)
--clickhouse-exporter-retry-max-backoff(uses global exporter default)
--clickhouse-exporter-retry-max-elapsed-time(uses global exporter default)

Table naming​

The ClickHouse endpoint must be specified while all other options can be left as defaults. The table prefix is prefixed onto the specific telemetry table name with underscore, so a table prefix of otel will be combined with _traces to generate the full table name of otel_traces.

Async inserts​

The ClickHouse exporter will enable async inserts by default, although it can be disabled server-side. Async inserts are recommended for most workloads to avoid overloading ClickHouse with many small inserts. Async inserts can be disabled by specifying: --clickhouse-exporter-async-insert false.

DDL​

The exporter will not generate the table schema if it does not exist. Use the clickhouse-ddl command for generating the necessary table DDL for ClickHouse. The DDL matches the schema used in the OpenTelemetry ClickHouse exporter.

JSON​

Enabling JSON via the --clickhouse-exporter-enable-json will use the new JSON data type in ClickHouse. This data type is only available on the most recent versions of ClickHouse. Make sure that you enable JSON with --enable-json when creating tables with clickhouse-ddl. By default, any JSON key inserted with a period in it will create a nested JSON object. You can replace periods in JSON keys with underscores by passing the option --clickhouse-exporter-json-underscore which will keep the JSON keys flat. For example, the resource attribute service.name will be inserted as service_name.


note

The ClickHouse exporter is built using code from the official Rust clickhouse-rs crate.