-
Notifications
You must be signed in to change notification settings - Fork 3.1k
fix(clickhouseexporter): respect TLS configuration when cert_file/key_file are missing and add test case (#43911) #44093
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
base: main
Are you sure you want to change the base?
Conversation
…_file are missing and add test case (open-telemetry#43911)
|
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! |
SpencerTorres
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as this doesn't break default configs, should be good. Also add changelog. Thanks!
Added changelog entry as requested. |
|
Thanks for the PR @harshit-jindal02 - don't edit the changelog directly, add the change using chloggen, follow the instructions at https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/a1bbdc152908d8822a0989a5bde4e44a798bd11d/CONTRIBUTING.md#changelog |
|
The tests are going to fail due to the changelog, but I'm approving the workflows to run so we get a run of the new test. |
Thanks @pjanotti, I’ve updated and validated the changelog entry as suggested. |
Summary
This PR fixes a bug in the ClickHouse exporter where the TLS configuration was ignored
if neither
cert_filenorkey_filewere set — even when a validca_filewas provided.As a result, server-side TLS verification setups (CA-only) failed unexpectedly.
Root Cause
In the previous logic inside
buildClickHouseOptions(), TLS initialization was conditionedon both
cert_fileandkey_filebeing provided.However, for many ClickHouse deployments, only a
ca_fileis necessary to validatethe server certificate without using client-side authentication.
This caused the exporter to skip TLS setup entirely when only
ca_filewas specified.Fix Implemented
Updated
buildClickHouseOptions()to initialize TLS even when only aca_fileis set.Ensured server-side TLS verification is correctly configured.
Added a new regression test to prevent future regressions:
TestBuildClickHouseOptions_WithCAFileOnlyThis test verifies:
Test Plan
Run locally:
Expected output:
Behavior Before
Behavior After
Affected Files
Related Issue
Fixes: #43911
Additional Notes
This improvement ensures the ClickHouse exporter correctly handles standard TLS verification
scenarios where a root CA file is provided but no client certificates are required.
It brings the exporter in line with expected ClickHouse server security behavior and adds
a regression test to safeguard future changes.