Sha256: ef703e52dd1457a3230ff1845f46abc8187f4b2a2b5eaa8817085d476114b422
Contents?: true
Size: 1.82 KB
Versions: 1
Compression:
Stored size: 1.82 KB
Contents
module OneApm module Agent class Agent module ForkableDispatcherFunctions def after_fork(options={}) needs_restart = false @after_fork_lock.synchronize do needs_restart = @harvester.needs_restart? @harvester.mark_started end return if !needs_restart || !Manager.config[:agent_enabled] || !Manager.config[:monitor_mode] || disconnected? OneApm::Manager.logger.debug "Starting the worker thread in #{Process.pid} (parent #{Process.ppid}) after forking." channel_id = options[:report_to_channel] install_pipe_service(channel_id) if channel_id reset_objects_with_locks drop_buffered_data setup_and_start_agent(options) end def install_pipe_service(channel_id) @service = OneApm::Agent::ForkedProcessService.new(channel_id) if connected? @connected_pid = Process.pid else OneApm::Manager.logger.debug("Child process #{Process.pid} not reporting to non-connected parent (process #{Process.ppid}).") @service.shutdown(Time.now) disconnect end end def synchronize_with_harvest harvest_lock.synchronize do yield end end def reset_objects_with_locks @stats_engine = OneApm::Collector::StatsEngine.new reset_harvest_locks end def reset_harvest_locks return if harvest_lock.nil? harvest_lock.unlock if harvest_lock.locked? end def flush_pipe_data if connected? && @service.is_a?(::OneApm::Agent::ForkedProcessService) transmit_data transmit_event_data end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
oneapm_rpm-1.1.3 | lib/one_apm/agent/agent/forkable_dispatcher_functions.rb |