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
Returns the value of attribute agent_id.
-
#buffer ⇒ Object
readonly
Returns the value of attribute buffer.
-
#channel_id ⇒ Object
readonly
Returns the value of attribute channel_id.
-
#collector ⇒ Object
Returns the value of attribute collector.
-
#pipe ⇒ Object
readonly
Returns the value of attribute pipe.
-
#request_timeout ⇒ Object
Returns the value of attribute request_timeout.
Instance Method Summary collapse
- #analytic_event_data(data) ⇒ Object
- #connect(config) ⇒ Object
- #error_data(errors) ⇒ Object
- #get_agent_commands ⇒ Object
-
#initialize(channel_id) ⇒ PipeService
constructor
A new instance of PipeService.
- #metric_data(last_harvest_time, now, unsent_timeslice_data) ⇒ Object
- #reset_metric_id_cache ⇒ Object
-
#session ⇒ Object
Invokes the block it is passed.
- #shutdown(time) ⇒ 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 21 |
# 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://newrelic.com/docs/ruby/resque-instrumentation for more information.") end end |
Instance Attribute Details
#agent_id ⇒ Object
Returns the value of attribute agent_id.
9 10 11 |
# File 'lib/new_relic/agent/pipe_service.rb', line 9 def agent_id @agent_id end |
#buffer ⇒ Object (readonly)
Returns the value of attribute buffer.
8 9 10 |
# File 'lib/new_relic/agent/pipe_service.rb', line 8 def buffer @buffer end |
#channel_id ⇒ Object (readonly)
Returns the value of attribute channel_id.
8 9 10 |
# File 'lib/new_relic/agent/pipe_service.rb', line 8 def channel_id @channel_id end |
#collector ⇒ Object
Returns the value of attribute collector.
9 10 11 |
# File 'lib/new_relic/agent/pipe_service.rb', line 9 def collector @collector end |
#pipe ⇒ Object (readonly)
Returns the value of attribute pipe.
8 9 10 |
# File 'lib/new_relic/agent/pipe_service.rb', line 8 def pipe @pipe end |
#request_timeout ⇒ Object
Returns the value of attribute request_timeout.
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(data) ⇒ Object
31 32 33 |
# File 'lib/new_relic/agent/pipe_service.rb', line 31 def analytic_event_data(data) nil end |
#connect(config) ⇒ Object
23 24 25 |
# File 'lib/new_relic/agent/pipe_service.rb', line 23 def connect(config) nil end |
#error_data(errors) ⇒ Object
44 45 46 |
# File 'lib/new_relic/agent/pipe_service.rb', line 44 def error_data(errors) write_to_pipe(:error_traces => errors) if errors end |
#get_agent_commands ⇒ Object
27 28 29 |
# File 'lib/new_relic/agent/pipe_service.rb', line 27 def get_agent_commands [] end |
#metric_data(last_harvest_time, now, unsent_timeslice_data) ⇒ Object
35 36 37 38 |
# File 'lib/new_relic/agent/pipe_service.rb', line 35 def metric_data(last_harvest_time, now, unsent_timeslice_data) write_to_pipe(:stats => unsent_timeslice_data) {} end |
#reset_metric_id_cache ⇒ Object
63 64 65 |
# File 'lib/new_relic/agent/pipe_service.rb', line 63 def reset_metric_id_cache # we don't cache metric IDs, so nothing to do 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.
59 60 61 |
# File 'lib/new_relic/agent/pipe_service.rb', line 59 def session yield end |
#shutdown(time) ⇒ Object
52 53 54 |
# File 'lib/new_relic/agent/pipe_service.rb', line 52 def shutdown(time) @pipe.close if @pipe end |
#sql_trace_data(sql) ⇒ Object
48 49 50 |
# File 'lib/new_relic/agent/pipe_service.rb', line 48 def sql_trace_data(sql) write_to_pipe(:sql_traces => sql) if sql end |
#transaction_sample_data(transactions) ⇒ Object
40 41 42 |
# File 'lib/new_relic/agent/pipe_service.rb', line 40 def transaction_sample_data(transactions) write_to_pipe(:transaction_traces => transactions) if transactions end |