From 406cabe54f8fb4937d0f6b73fe830a51c04fdb92 Mon Sep 17 00:00:00 2001 From: Tobin Richard <154486084+megabus-tobin@users.noreply.github.com> Date: Sat, 29 Jun 2024 08:43:19 +1000 Subject: [PATCH] feat: Improve SSL error logging. (#1644) Log more information about why an SSL error occured as this can be very difficult to diagnose. This is logged in the same way as other probably fatal issues are, e.g. HTTP 404s. Co-authored-by: Matthew Wear --- .../lib/opentelemetry/exporter/otlp/http/trace_exporter.rb | 3 ++- exporter/otlp/lib/opentelemetry/exporter/otlp/exporter.rb | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/exporter/otlp-http/lib/opentelemetry/exporter/otlp/http/trace_exporter.rb b/exporter/otlp-http/lib/opentelemetry/exporter/otlp/http/trace_exporter.rb index 0ae739df5a..de2b857788 100644 --- a/exporter/otlp-http/lib/opentelemetry/exporter/otlp/http/trace_exporter.rb +++ b/exporter/otlp-http/lib/opentelemetry/exporter/otlp/http/trace_exporter.rb @@ -180,8 +180,9 @@ def send_bytes(bytes, timeout:) # rubocop:disable Metrics/MethodLength rescue Net::OpenTimeout, Net::ReadTimeout retry if backoff?(retry_count: retry_count += 1, reason: 'timeout') return FAILURE - rescue OpenSSL::SSL::SSLError + rescue OpenSSL::SSL::SSLError => e retry if backoff?(retry_count: retry_count += 1, reason: 'openssl_error') + OpenTelemetry.handle_error(exception: e, message: 'SSL error in OTLP::Exporter#send_bytes') return FAILURE rescue SocketError retry if backoff?(retry_count: retry_count += 1, reason: 'socket_error') diff --git a/exporter/otlp/lib/opentelemetry/exporter/otlp/exporter.rb b/exporter/otlp/lib/opentelemetry/exporter/otlp/exporter.rb index b017e4a30c..1f32c4bd19 100644 --- a/exporter/otlp/lib/opentelemetry/exporter/otlp/exporter.rb +++ b/exporter/otlp/lib/opentelemetry/exporter/otlp/exporter.rb @@ -184,8 +184,9 @@ def send_bytes(bytes, timeout:) # rubocop:disable Metrics/CyclomaticComplexity, rescue Net::OpenTimeout, Net::ReadTimeout retry if backoff?(retry_count: retry_count += 1, reason: 'timeout') return FAILURE - rescue OpenSSL::SSL::SSLError + rescue OpenSSL::SSL::SSLError => e retry if backoff?(retry_count: retry_count += 1, reason: 'openssl_error') + OpenTelemetry.handle_error(exception: e, message: 'SSL error in OTLP::Exporter#send_bytes') return FAILURE rescue SocketError retry if backoff?(retry_count: retry_count += 1, reason: 'socket_error')