Skip to content

exporter/clickhouse: backtick-quote cluster_name in ON CLUSTER clause#47835

Open
SAY-5 wants to merge 1 commit intoopen-telemetry:mainfrom
SAY-5:fix/clickhouse-cluster-quoting-46946
Open

exporter/clickhouse: backtick-quote cluster_name in ON CLUSTER clause#47835
SAY-5 wants to merge 1 commit intoopen-telemetry:mainfrom
SAY-5:fix/clickhouse-cluster-quoting-46946

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented Apr 21, 2026

Description:

clusterString emitted ON CLUSTER <name> with no quoting. A valid cluster_name containing a dash (ch-cluster is the one the reporter hit), a space, or any non-alphanumeric identifier character caused ClickHouse to reject every schema-creation DDL and the pipeline failed to start:

failed to start "clickhouse" exporter: create database: code: 62,
message: Syntax error: failed at position 51 (-): -cluster

Fix: backtick-quote the identifier, doubling any embedded backtick per ClickHouse's quoted-identifier escape rule. Existing tests updated to the quoted form plus two new cases covering ch-cluster and weird + backtick + name.

Link to tracking issue: Fixes #46946

Testing: go test ./exporter/clickhouseexporter/... -count=1 passes.

Documentation: Added .chloggen/46946-clickhouse-cluster-quoting.yaml under bug_fix.

Signed-off-by: SAY-5 SAY-5@users.noreply.github.com
Assisted-by: Claude Opus 4.7

clusterString emitted `ON CLUSTER <name>` without any quoting. A valid
cluster_name that contains a dash (`ch-cluster` is the one the reporter
hit), a space, or any non-alphanumeric identifier character caused
ClickHouse to reject every schema-creation DDL with a syntax error and
the pipeline failed to start:

  failed to start "clickhouse" exporter: create database: code: 62,
  message: Syntax error: failed at position 51 (-): -cluster

Quote the identifier with backticks and double any embedded backticks
(ClickHouse's quoted-identifier escape rule). Existing tests are
updated to the quoted form plus two new cases covering `ch-cluster`
and `weird``name`.

Fixes open-telemetry#46946.

Signed-off-by: SAY-5 <SAY-5@users.noreply.github.com>
Assisted-by: Claude Opus 4.7
@SAY-5 SAY-5 requested a review from a team as a code owner April 21, 2026 19:47
@SAY-5 SAY-5 requested a review from braydonk April 21, 2026 19:47
@github-actions github-actions Bot added the first-time contributor PRs made by new contributors label Apr 21, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Welcome, contributor! Thank you for your contribution to opentelemetry-collector-contrib.

Important reminders:

A maintainer will review your pull request soon. Thank you for helping make OpenTelemetry better!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clickhouse Exporter, Cluster containing a dash (- )

2 participants