Skip to main content

Clickhouse Exporter

Export OpenTelemetry metrics, logs and traces to Clickhouse.

Telemetry TypeSupport
TracesAlpha
LogsAlpha

The Clickhouse exporter can be selected by passing --exporter clickhouse. The Clickhouse exporter only supports logs and traces at the moment.

OptionDefaultOptions
--clickhouse-exporter-endpoint
--clickhouse-exporter-databaseotel
--clickhouse-exporter-table-prefixotel
--clickhouse-exporter-compressionlz4none, lz4
--clickhouse-exporter-async-inserttruetrue, false
--clickhouse-exporter-enable-json
--clickhouse-exporter-json-underscore
--clickhouse-exporter-user
--clickhouse-exporter-password

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.

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.

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.

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.

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