Class: NewRelic::Agent::PipeService

Inherits:
Object
  • Object
show all
Defined in:
lib/new_relic/agent/pipe_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_idObject

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

#bufferObject (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_idObject (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

#collectorObject

Returns the value of attribute collector.



9
10
11
# File 'lib/new_relic/agent/pipe_service.rb', line 9

def collector
  @collector
end

#pipeObject (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_timeoutObject

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_commandsObject



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_cacheObject



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

#sessionObject

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