Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clickhouse - Use std batch api to insert data #18090

Closed
StarpTech opened this issue Jan 29, 2023 · 5 comments
Closed

Clickhouse - Use std batch api to insert data #18090

StarpTech opened this issue Jan 29, 2023 · 5 comments
Labels
enhancement New feature or request exporter/clickhouse needs triage New item requiring triage

Comments

@StarpTech
Copy link
Contributor

Component(s)

exporter/clickhouse

Is your feature request related to a problem? Please describe.

Hi, according to https://github.com/StarpTech/opentelemetry-collector-contrib/blob/feat/improve_clickhouse_conn_mgmnt/exporter/clickhouseexporter/exporter_logs.go#L94 we issue a request per log / trace. Is there any reason for that? This must be very inefficient. We can improve it by switching to https://github.com/ClickHouse/clickhouse-go/blob/main/examples/std/batch.go

begin->prepare->(in loop exec)->commit

Describe the solution you'd like

Use prepared statement https://github.com/ClickHouse/clickhouse-go/blob/main/examples/std/batch.go

Describe alternatives you've considered

No response

Additional context

No response

@StarpTech StarpTech added enhancement New feature or request needs triage New item requiring triage labels Jan 29, 2023
@github-actions
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@hanjm
Copy link
Member

hanjm commented Jan 29, 2023

we issue a request per log / trace.

no, when use batch processor, exporter will do batch insert.

Note:
Always
add [batch-processor](https://github.com/open-telemetry/opentelemetry-collector/tree/main/processor/batchprocessor) to
collector pipeline,

## General Recommendations
Below are some recommendations that apply to typical components. These are not rigid rules and there are exceptions but
in general try to follow them.
- Avoid introducing batching, retries or worker pools directly on receivers and exporters. Typically, these are general
cases that can be better handled via processors (that also can be reused by other receivers and exporters).

@StarpTech
Copy link
Contributor Author

StarpTech commented Jan 29, 2023

How does it work? Isn't ExecContext synchronous per entry?

@StarpTech
Copy link
Contributor Author

@hanjm great, thanks for clarifying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request exporter/clickhouse needs triage New item requiring triage
Projects
None yet
Development

No branches or pull requests

2 participants