Skip to content

Commit f08c802

Browse files
authored
fix: add rescue for OpenSSL errors during export (#884)
Closes #883. Signed-off-by: Robb Kidd <[email protected]>
1 parent 980f0e4 commit f08c802

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

exporter/otlp/lib/opentelemetry/exporter/otlp/exporter.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ def send_bytes(bytes, timeout:) # rubocop:disable Metrics/AbcSize, Metrics/Cyclo
199199
rescue Net::OpenTimeout, Net::ReadTimeout
200200
retry if backoff?(retry_count: retry_count += 1, reason: 'timeout')
201201
return FAILURE
202+
rescue OpenSSL::SSL::SSLError
203+
retry if backoff?(retry_count: retry_count += 1, reason: 'openssl_error')
204+
return FAILURE
202205
rescue SocketError
203206
retry if backoff?(retry_count: retry_count += 1, reason: 'socket_error')
204207
return FAILURE

exporter/otlp/test/opentelemetry/exporter/otlp/exporter_test.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,14 @@
182182
_(result).must_equal(FAILURE)
183183
end
184184

185+
it 'returns FAILURE when encryption to receiver endpoint fails' do
186+
stub_request(:post, 'https://localhost:4317/v1/traces').to_raise(OpenSSL::SSL::SSLError.new('enigma wedged'))
187+
span_data = create_span_data
188+
exporter.stub(:backoff?, ->(**_) { false }) do
189+
_(exporter.export([span_data])).must_equal(FAILURE)
190+
end
191+
end
192+
185193
it 'exports a span_data' do
186194
stub_request(:post, 'https://localhost:4317/v1/traces').to_return(status: 200)
187195
span_data = create_span_data

0 commit comments

Comments
 (0)