Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/ddtrace/workers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def callback_traces
# ensures that the thread will not die because of an exception.
# TODO[manu]: findout the reason and reschedule the send if it's not
# a fatal exception
Datadog::Tracer.log.error("Error during traces flush: dropped #{items.length} items. Cause: #{e}")
Datadog::Tracer.log.error("Error during traces flush: dropped #{traces.length} items. Cause: #{e}")
end
end

Expand All @@ -58,7 +58,7 @@ def callback_services
# ensures that the thread will not die because of an exception.
# TODO[manu]: findout the reason and reschedule the send if it's not
# a fatal exception
Datadog::Tracer.log.error("Error during services flush: dropped #{items.length} items. Cause: #{e}")
Datadog::Tracer.log.error("Error during services flush: dropped #{services.length} items. Cause: #{e}")
end
end

Expand Down
23 changes: 23 additions & 0 deletions spec/ddtrace/workers_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
require 'spec_helper'

RSpec.describe Datadog::Workers::AsyncTransport do
describe 'callbacks' do
describe 'when raising errors' do
it 'does not re-raise' do
buf = StringIO.new
Datadog::Tracer.log = Datadog::Logger.new(buf)
task = proc { raise StandardError }
worker = Datadog::Workers::AsyncTransport.new(nil, 100, task, task, 0.5)

worker.enqueue_trace(get_test_traces(1))
worker.enqueue_service(get_test_services)

expect { worker.callback_traces }.to_not raise_error
expect { worker.callback_services }.to_not raise_error

lines = buf.string.lines
expect(lines.count).to eq 2
end
end
end
end