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 exporter not working with https #18079

Closed
StarpTech opened this issue Jan 27, 2023 · 5 comments · Fixed by #18085
Closed

Clickhouse exporter not working with https #18079

StarpTech opened this issue Jan 27, 2023 · 5 comments · Fixed by #18085
Labels
bug Something isn't working exporter/clickhouse

Comments

@StarpTech
Copy link
Contributor

StarpTech commented Jan 27, 2023

Component(s)

No response

What happened?

Description

Hi, I cannot connect to a Clickhouse instance over HTTPS. It would be great if you could provide an example if I'm doing something wrong.

Steps to Reproduce

Make a free account on https://clickhouse.com/ and try to connect the exporter with it.

Expected Result

Actual Result

Collector version

0.70.0

Environment information

Environment

OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")

OpenTelemetry Collector configuration

receivers:
  otlp:
    protocols:
      grpc:
      http:

processors:
  batch:
    send_batch_size: 4000
    send_batch_max_size: 4000
    timeout: 10s
  memory_limiter:
    # 80% of maximum memory up to 2G
    limit_mib: 1500
    # 25% of limit up to 2G
    spike_limit_mib: 512
    check_interval: 5s

exporters:
  clickhouse:
    endpoint: "https://$HOST:8443"
    database: otel
    logs_table_name: otel_logs
    traces_table_name: otel_traces
    username: foo
    password: bar
    connection_params:
      read_timeout: 20s
      write_timeout: 30s
      secure: true
      debug: true
    ttl_days: 3
    timeout: 20s
    sending_queue:
      queue_size: 100
    retry_on_failure:
      enabled: true
      initial_interval: 5s
      max_interval: 30s
      max_elapsed_time: 300s

extensions:
  health_check:

service:
  extensions: [health_check]
  pipelines:
    traces:
      receivers: [otlp]
      processors: [memory_limiter, batch]
      exporters: [clickhouse]

Log output

2023-01-27T21:56:30Z   [info]Error: cannot build pipelines: failed to create "clickhouse" exporter, in pipeline "traces": cannot configure clickhouse traces exporter: create database:Post "https://YOUR_HOST:8443?database=default&default_format=Native&write_timeout=30s": dial tcp: lookup YOUR_HOST: i/o timeout
2023-01-27T21:56:30Z   [info]2023/01/27 21:56:30 collector server run finished with error: cannot build pipelines: failed to create "clickhouse" exporter, in pipeline "traces": cannot configure clickhouse traces exporter: create database:Post "https://YOUR_HOST:8443?database=default&default_format=Native&write_timeout=30s": dial tcp: lookup YOUR_HOST: i/o timeout
2023-01-27T21:56:31Z   [info]Starting clean up.

Additional context

I tried it with github.com/ClickHouse/clickhouse-go/v2 through sql.Open and it worked fine.

	url := fmt.Sprintf(
		"https://%s:%d?username=%s&password=%s&secure", host, https_port, username, password)
@StarpTech StarpTech added bug Something isn't working needs triage New item requiring triage labels Jan 27, 2023
@atoulme
Copy link
Contributor

atoulme commented Jan 28, 2023

It appears https://$HOST:8443 is not interpolated. Please try replacing $HOST with the proper hostname.

@atoulme atoulme added exporter/clickhouse and removed needs triage New item requiring triage labels Jan 28, 2023
@github-actions
Copy link
Contributor

Pinging code owners for exporter/clickhouse: @hanjm @dmitryax @Frapschen. See Adding Labels via Comments if you do not have permissions to add labels yourself.

@StarpTech
Copy link
Contributor Author

StarpTech commented Jan 28, 2023

Hi @atoulme, sorry for the confusion. I put $HOST to hide my private data. I replaced it with YOUR_HOST

@StarpTech
Copy link
Contributor Author

I think the missing piece is that we don't pass TLS config correctly to the client https://github.com/ClickHouse/clickhouse-go/blob/main/examples/std/ssl.go We should instantiate it with clickhouse.OpenDB and pass the right settings as shown in the example.

@bogdandrutu
Copy link
Member

@atoulme even though is not relevant in this issue, consider to encourage https://${HOST}:8443. Better separates the env var from the string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working exporter/clickhouse
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants