Skip to content

Commit

Permalink
Merge pull request #4062 from DataDog/ivoanjo/fix-rubocop-lint
Browse files Browse the repository at this point in the history
[NO-TICKET] Fix rubocop lint
  • Loading branch information
TonyCTHsu authored Nov 4, 2024
2 parents 7948a96 + f208359 commit ce863f0
Showing 1 changed file with 26 additions and 28 deletions.
54 changes: 26 additions & 28 deletions lib/datadog/tracing/writer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,6 @@ def start
end
end

# spawns a worker for spans; they share the same transport which is thread-safe
# @!visibility private
def start_worker
@trace_handler = ->(items, transport) { send_spans(items, transport) }
@worker = Workers::AsyncTransport.new(
transport: @transport,
buffer_size: @buff_size,
on_trace: @trace_handler,
interval: @flush_interval,
shutdown_timeout: @shutdown_timeout
)

@worker.start
end

# Gracefully shuts down this writer.
#
# Once stopped methods calls won't fail, but
Expand All @@ -93,19 +78,6 @@ def stop
@mutex_after_fork.synchronize { stop_worker }
end

def stop_worker
@stopped = true

return if @worker.nil?

@worker.stop
@worker = nil

true
end

private :start_worker, :stop_worker

# flush spans to the trace-agent, handles spans only
# @!visibility private
def send_spans(traces, transport)
Expand Down Expand Up @@ -179,6 +151,32 @@ def initialize

private

# spawns a worker for spans; they share the same transport which is thread-safe
# @!visibility private
def start_worker
@trace_handler = ->(items, transport) { send_spans(items, transport) }
@worker = Workers::AsyncTransport.new(
transport: @transport,
buffer_size: @buff_size,
on_trace: @trace_handler,
interval: @flush_interval,
shutdown_timeout: @shutdown_timeout
)

@worker.start
end

def stop_worker
@stopped = true

return if @worker.nil?

@worker.stop
@worker = nil

true
end

def reset_stats!
@traces_flushed = 0
@transport.stats.reset!
Expand Down

0 comments on commit ce863f0

Please sign in to comment.