Class: NewRelic::Agent::PipeService
- Inherits:
-
Object
- Object
- NewRelic::Agent::PipeService
- Defined in:
- lib/new_relic/agent/pipe_service.rb
Instance Attribute Summary collapse
- #agent_id ⇒ Object
- #buffer ⇒ Object readonly
- #channel_id ⇒ Object readonly
- #collector ⇒ Object
- #pipe ⇒ Object readonly
- #request_timeout ⇒ Object
Instance Method Summary collapse
- #analytic_event_data(events) ⇒ Object
- #connect(config) ⇒ Object
- #custom_event_data(events) ⇒ Object
- #error_data(errors) ⇒ Object
- #error_event_data(events) ⇒ Object
- #get_agent_commands ⇒ Object
-
#initialize(channel_id) ⇒ PipeService
constructor
A new instance of PipeService.
- #log_event_data(logs) ⇒ Object
- #metric_data(unsent_timeslice_data) ⇒ Object
-
#session ⇒ Object
Invokes the block it is passed.
- #shutdown ⇒ Object
- #span_event_data(events) ⇒ Object
- #sql_trace_data(sql) ⇒ Object
- #transaction_sample_data(transactions) ⇒ Object
Constructor Details
#initialize(channel_id) ⇒ PipeService
Returns a new instance of PipeService.
11 12 13 14 15 16 17 18 19 20 |
# 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 |
Instance Attribute Details
#agent_id ⇒ Object
9 10 11 |
# File 'lib/new_relic/agent/pipe_service.rb', line 9 def agent_id @agent_id end |
#buffer ⇒ Object (readonly)
8 9 10 |
# File 'lib/new_relic/agent/pipe_service.rb', line 8 def buffer @buffer end |
#channel_id ⇒ Object (readonly)
8 9 10 |
# File 'lib/new_relic/agent/pipe_service.rb', line 8 def channel_id @channel_id end |
#collector ⇒ Object
9 10 11 |
# File 'lib/new_relic/agent/pipe_service.rb', line 9 def collector @collector end |
#pipe ⇒ Object (readonly)
8 9 10 |
# File 'lib/new_relic/agent/pipe_service.rb', line 8 def pipe @pipe end |
#request_timeout ⇒ Object
9 10 11 |
# File 'lib/new_relic/agent/pipe_service.rb', line 9 def request_timeout @request_timeout end |
Instance Method Details
#analytic_event_data(events) ⇒ Object
30 31 32 |
# 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 |
#connect(config) ⇒ Object
22 23 24 |
# File 'lib/new_relic/agent/pipe_service.rb', line 22 def connect(config) nil end |
#custom_event_data(events) ⇒ Object
34 35 36 |
# 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 |
#error_data(errors) ⇒ Object
47 48 49 |
# File 'lib/new_relic/agent/pipe_service.rb', line 47 def error_data(errors) write_to_pipe(:error_data, errors) if errors end |
#error_event_data(events) ⇒ Object
51 52 53 |
# 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 |
#get_agent_commands ⇒ Object
26 27 28 |
# File 'lib/new_relic/agent/pipe_service.rb', line 26 def get_agent_commands NewRelic::EMPTY_ARRAY end |
#log_event_data(logs) ⇒ Object
63 64 65 |
# 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 |
#metric_data(unsent_timeslice_data) ⇒ Object
38 39 40 41 |
# 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 |
#session ⇒ Object
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.
75 76 77 |
# File 'lib/new_relic/agent/pipe_service.rb', line 75 def session yield end |
#shutdown ⇒ Object
67 68 69 70 |
# 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 |
#span_event_data(events) ⇒ Object
55 56 57 |
# 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 |
#sql_trace_data(sql) ⇒ Object
59 60 61 |
# 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 |
#transaction_sample_data(transactions) ⇒ Object
43 44 45 |
# 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 |