class NewRelic::Agent::PipeService
Attributes
Public Class Methods
Source
# File lib/new_relic/agent/pipe_service.rb, line 11 def initialize(channel_id) @channel_id = channel_id @collector = NewRelic::Control::Server.new({name: 'parent', port: 0}) @pipe = NewRelic::Agent::PipeChannelManager.channels[@channel_id] if @pipe && @pipe.parent_pid != $$ @pipe.after_fork_in_child else NewRelic::Agent.logger.error('No communication channel to parent process, please see https://docs.newrelic.com/docs/apm/agents/ruby-agent/background-jobs/resque-instrumentation/ for more information.') end end
Public Instance Methods
Source
# File lib/new_relic/agent/pipe_service.rb, line 30 def analytic_event_data(events) write_to_pipe(:analytic_event_data, events) if events end
Source
# File lib/new_relic/agent/pipe_service.rb, line 22 def connect(config) nil end
Source
# File lib/new_relic/agent/pipe_service.rb, line 34 def custom_event_data(events) write_to_pipe(:custom_event_data, events) if events end
Source
# File lib/new_relic/agent/pipe_service.rb, line 47 def error_data(errors) write_to_pipe(:error_data, errors) if errors end
Source
# File lib/new_relic/agent/pipe_service.rb, line 51 def error_event_data(events) write_to_pipe(:error_event_data, events) if events end
Source
# File lib/new_relic/agent/pipe_service.rb, line 26 def get_agent_commands NewRelic::EMPTY_ARRAY end
Source
# File lib/new_relic/agent/pipe_service.rb, line 63 def log_event_data(logs) write_to_pipe(:log_event_data, logs) if logs end
Source
# File lib/new_relic/agent/pipe_service.rb, line 38 def metric_data(unsent_timeslice_data) write_to_pipe(:metric_data, unsent_timeslice_data) {} end
Source
# File lib/new_relic/agent/pipe_service.rb, line 75 def session yield end
Invokes the block it is passed. This is used to implement HTTP keep-alive in the NewRelicService
, and is a required interface for any Service class.
Source
# File lib/new_relic/agent/pipe_service.rb, line 67 def shutdown # no else branch coverage @pipe.close if @pipe # rubocop:disable Style/SafeNavigation end
Source
# File lib/new_relic/agent/pipe_service.rb, line 55 def span_event_data(events) write_to_pipe(:span_event_data, events) if events end
Source
# File lib/new_relic/agent/pipe_service.rb, line 59 def sql_trace_data(sql) write_to_pipe(:sql_trace_data, sql) if sql end
Source
# File lib/new_relic/agent/pipe_service.rb, line 43 def transaction_sample_data(transactions) write_to_pipe(:transaction_sample_data, transactions) if transactions end
Private Instance Methods
Source
# File lib/new_relic/agent/pipe_service.rb, line 81 def marshal_payload(data) Marshal.dump(data) end
Source
# File lib/new_relic/agent/pipe_service.rb, line 85 def write_to_pipe(endpoint, data) # the following line needs else branch coverage @pipe.write(marshal_payload([endpoint, data])) if @pipe # rubocop:disable Style/SafeNavigation end