Sha256: cf61c1394d5a37e52c947c0213590550fcd300400f429562450ff6a4085f6452
Contents?: true
Size: 1.99 KB
Versions: 1
Compression:
Stored size: 1.99 KB
Contents
# encoding: utf-8 module OneApm module Agent class ForkedProcessService attr_reader :channel_id, :buffer, :pipe attr_accessor :request_timeout, :agent_id, :collector def initialize(channel_id) @channel_id = channel_id @collector = OneApm::Support::Server.new(:name => 'parent', :port => 0) @pipe = OneApm::Support::ForkedProcessChannel.channels[@channel_id] if @pipe && @pipe.parent_pid != $$ @pipe.after_fork_in_child else OneApm::Manager.logger.error("No communication channel to parent process.") end end def connect(config) nil end def get_agent_commands [] end def analytic_event_data(events) write_to_pipe(:analytic_event_data, events) if events end def custom_event_data(events) write_to_pipe(:custom_event_data, events) if events end def metric_data(unsent_timeslice_data) write_to_pipe(:metric_data, unsent_timeslice_data) {} end def transaction_sample_data(transactions) write_to_pipe(:transaction_sample_data, transactions) if transactions end def error_data(errors) write_to_pipe(:error_data, errors) if errors end def sql_trace_data(sql) write_to_pipe(:sql_trace_data, sql) if sql end def shutdown(time) @pipe.close if @pipe end # Invokes the block it is passed. This is used to implement HTTP # keep-alive in the CollectorService, and is a required interface for any # Service class. def session yield end def reset_metric_id_cache # we don't cache metric IDs, so nothing to do end private def marshal_payload(data) OneApm::LanguageSupport.with_cautious_gc do Marshal.dump(data) end end def write_to_pipe(endpoint, data) @pipe.write(marshal_payload([endpoint, data])) if @pipe end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
oneapm_rpm-1.1.3 | lib/one_apm/collector/forked_process_service.rb |