From ec7d2a4350241f55e2b0feb80cf33f8ca6217cec Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Tue, 12 Sep 2023 12:47:54 +0300 Subject: [PATCH] Use default Vert.x client settings in OTel exporters --- .../runtime/exporter/otlp/OtlpRecorder.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/OtlpRecorder.java b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/OtlpRecorder.java index 4c262a2bb6cfc..2da845ca59599 100644 --- a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/OtlpRecorder.java +++ b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/OtlpRecorder.java @@ -219,8 +219,12 @@ private void configureTLS(HttpClientOptions options) { } private KeyCertOptions toPemKeyCertOptions() { - PemKeyCertOptions pemKeyCertOptions = new PemKeyCertOptions(); OtlpExporterTracesConfig.KeyCert keyCert = tracesConfig.keyCert(); + if (keyCert.certs().isEmpty() && keyCert.keys().isEmpty()) { + return null; + } + + PemKeyCertOptions pemKeyCertOptions = new PemKeyCertOptions(); if (keyCert.certs().isPresent()) { for (String cert : keyCert.certs().get()) { pemKeyCertOptions.addCertPath(cert); @@ -235,14 +239,18 @@ private KeyCertOptions toPemKeyCertOptions() { } private PemTrustOptions toPemTrustOptions() { - PemTrustOptions pemTrustOptions = new PemTrustOptions(); OtlpExporterTracesConfig.TrustCert trustCert = tracesConfig.trustCert(); if (trustCert.certs().isPresent()) { - for (String cert : trustCert.certs().get()) { - pemTrustOptions.addCertPath(cert); + List certs = trustCert.certs().get(); + if (!certs.isEmpty()) { + PemTrustOptions pemTrustOptions = new PemTrustOptions(); + for (String cert : trustCert.certs().get()) { + pemTrustOptions.addCertPath(cert); + } + return pemTrustOptions; } } - return pemTrustOptions; + return null; } } }