@@ -68,21 +68,6 @@ def start
6868 end
6969 end
7070
71- # spawns a worker for spans; they share the same transport which is thread-safe
72- # @!visibility private
73- def start_worker
74- @trace_handler = -> ( items , transport ) { send_spans ( items , transport ) }
75- @worker = Workers ::AsyncTransport . new (
76- transport : @transport ,
77- buffer_size : @buff_size ,
78- on_trace : @trace_handler ,
79- interval : @flush_interval ,
80- shutdown_timeout : @shutdown_timeout
81- )
82-
83- @worker . start
84- end
85-
8671 # Gracefully shuts down this writer.
8772 #
8873 # Once stopped methods calls won't fail, but
@@ -93,19 +78,6 @@ def stop
9378 @mutex_after_fork . synchronize { stop_worker }
9479 end
9580
96- def stop_worker
97- @stopped = true
98-
99- return if @worker . nil?
100-
101- @worker . stop
102- @worker = nil
103-
104- true
105- end
106-
107- private :start_worker , :stop_worker
108-
10981 # flush spans to the trace-agent, handles spans only
11082 # @!visibility private
11183 def send_spans ( traces , transport )
@@ -179,6 +151,32 @@ def initialize
179151
180152 private
181153
154+ # spawns a worker for spans; they share the same transport which is thread-safe
155+ # @!visibility private
156+ def start_worker
157+ @trace_handler = -> ( items , transport ) { send_spans ( items , transport ) }
158+ @worker = Workers ::AsyncTransport . new (
159+ transport : @transport ,
160+ buffer_size : @buff_size ,
161+ on_trace : @trace_handler ,
162+ interval : @flush_interval ,
163+ shutdown_timeout : @shutdown_timeout
164+ )
165+
166+ @worker . start
167+ end
168+
169+ def stop_worker
170+ @stopped = true
171+
172+ return if @worker . nil?
173+
174+ @worker . stop
175+ @worker = nil
176+
177+ true
178+ end
179+
182180 def reset_stats!
183181 @traces_flushed = 0
184182 @transport . stats . reset!
0 commit comments