Skip to main content

Clickhouse Exporter

Export OpenTelemetry metrics, logs and traces to Clickhouse.

Telemetry TypeSupport
TracesAlpha
LogsAlpha
MetricsAlpha

Options

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-enable-json
--clickhouse-exporter-json-underscore
--clickhouse-exporter-user
--clickhouse-exporter-password

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.