Skip to content

[exporter/clickhouse] Add configuration flag to toggle clickhouse-go WithReleaseConnection for batch inserts #44751

@tank-500m

Description

@tank-500m

Component(s)

exporter/clickhouse

Describe the issue you're reporting

I’d like to be able to control whether the ClickHouse exporter uses the WithReleaseConnection PrepareBatch option from clickhouse-go when inserting data.

The ClickHouse Go client exposes WithReleaseConnection as a PrepareBatch option:

WithReleaseConnection - after PrepareBatch connection will be returned to the pool. It can help you make a long-lived batch.

In some environments, always enabling WithReleaseConnection might be preferable; in others (few workers, short-lived batches, very high MaxOpenConns) holding a connection for the entire batch lifetime may be slightly simpler and marginally faster. Because of that, it would be very helpful to have this as an explicit exporter configuration flag rather than a hard-coded choice.

Proposed solution

Add a boolean configuration option to the ClickHouse exporter to toggle WithReleaseConnection for batch inserts. For example:

exporters:
  clickhouse:
    endpoint: tcp://clickhouse:9000?dial_timeout=10s&compress=zstd
    database: o11y
    logs_table_name: otel_logs
    traces_table_name: otel_traces
    metrics_table_name: otel_metrics
    # new option
    release_connection: true


### Tip

<sub>[React](https://github.blog/news-insights/product-news/add-reactions-to-pull-requests-issues-and-comments/) with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it. Learn more [here](https://opentelemetry.io/community/end-user/issue-participation/).</sub>

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions