class OneApm::Agent::Harvester

Attributes

starting_pid[RW]

Public Class Methods

new(events, after_forker = OneApm::Manager) click to toggle source
# File lib/one_apm/agent/harvester.rb, line 9
def initialize(events, after_forker = OneApm::Manager)
  @starting_pid = nil
  @after_forker = after_forker

  if events
    events.subscribe(:start_transaction, &method(:on_transaction))
  end
end

Public Instance Methods

harvest_thread_enabled?() click to toggle source
# File lib/one_apm/agent/harvester.rb, line 36
def harvest_thread_enabled?
  !OneApm::Manager.config[:disable_harvest_thread]
end
mark_started(pid = Process.pid) click to toggle source
# File lib/one_apm/agent/harvester.rb, line 24
def mark_started(pid = Process.pid)
  @starting_pid = pid
end
needs_restart?(pid = Process.pid) click to toggle source
# File lib/one_apm/agent/harvester.rb, line 28
def needs_restart?(pid = Process.pid)
  @starting_pid != pid
end
on_transaction(*_) click to toggle source
# File lib/one_apm/agent/harvester.rb, line 18
def on_transaction(*_)
  return unless restart_in_children_enabled? && needs_restart? && harvest_thread_enabled?

  restart_harvest_thread
end
restart_harvest_thread() click to toggle source
# File lib/one_apm/agent/harvester.rb, line 40
def restart_harvest_thread
  @after_forker.after_fork(:force_reconnect => true)
end
restart_in_children_enabled?() click to toggle source
# File lib/one_apm/agent/harvester.rb, line 32
def restart_in_children_enabled?
  OneApm::Manager.config[:restart_thread_in_children]
end