Describe the bug
TlsConfigHelper documents that the PEM-based higher level API and the lower level setSslContext are mutually exclusive, but the keyManager / sslContext combination is not checked. Configuring both silently drops the client certificate.
Steps to reproduce
OtlpHttpSpanExporter.builder()
.setClientTls(privateKeyPem, certificatePem) // sets keyManager
.setSslContext(sslContext, trustManager) // no exception
.build(); // client certificate is gone
What did you expect to see?
An IllegalStateException. The class Javadoc says the two APIs may be used "but NOT both", and OtlpHttpSpanExporterBuilder.setSslContext says "Users should call this or set raw certificate bytes, but not both". The trustManager side already enforces this in both directions.
What did you see instead?
Both calls succeed. setSslContext (line 95) checks only sslContext and trustManager; setKeyManagerFromCerts (line 72) checks only keyManager. HttpExporterBuilder and GrpcExporterBuilder read getSslContext() and getTrustManager() only, so the key manager never reaches the connection. Against an mTLS collector this surfaces as an unexplained handshake failure.
What version and what artifacts are you using?
Artifacts: opentelemetry-exporter-common, opentelemetry-exporter-otlp
Version: main @ d948e13 (1.66.0-SNAPSHOT)
How did you reference these artifacts? Built from source.
Environment
Compiler: Temurin 21
OS: N/A
Additional context
N/A
Describe the bug
TlsConfigHelperdocuments that the PEM-based higher level API and the lower levelsetSslContextare mutually exclusive, but thekeyManager/sslContextcombination is not checked. Configuring both silently drops the client certificate.Steps to reproduce
What did you expect to see?
An
IllegalStateException. The class Javadoc says the two APIs may be used "but NOT both", andOtlpHttpSpanExporterBuilder.setSslContextsays "Users should call this or set raw certificate bytes, but not both". ThetrustManagerside already enforces this in both directions.What did you see instead?
Both calls succeed.
setSslContext(line 95) checks onlysslContextandtrustManager;setKeyManagerFromCerts(line 72) checks onlykeyManager.HttpExporterBuilderandGrpcExporterBuilderreadgetSslContext()andgetTrustManager()only, so the key manager never reaches the connection. Against an mTLS collector this surfaces as an unexplained handshake failure.What version and what artifacts are you using?
Artifacts: opentelemetry-exporter-common, opentelemetry-exporter-otlp
Version: main @ d948e13 (1.66.0-SNAPSHOT)
How did you reference these artifacts? Built from source.
Environment
Compiler: Temurin 21
OS: N/A
Additional context
N/A