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.



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

def initialize(channel_id)
  @channel_id = channel_id
  @collector = NewRelic::Control::Server.new(:name => 'parent',
                                             :port => 0)
end

Instance Attribute Details

#agent_idObject

Returns the value of attribute agent_id.



5
6
7
# File 'lib/new_relic/agent/pipe_service.rb', line 5

def agent_id
  @agent_id
end

#bufferObject (readonly)

Returns the value of attribute buffer.



4
5
6
# File 'lib/new_relic/agent/pipe_service.rb', line 4

def buffer
  @buffer
end

#channel_idObject (readonly)

Returns the value of attribute channel_id.



4
5
6
# File 'lib/new_relic/agent/pipe_service.rb', line 4

def channel_id
  @channel_id
end

#collectorObject

Returns the value of attribute collector.



5
6
7
# File 'lib/new_relic/agent/pipe_service.rb', line 5

def collector
  @collector
end

#request_timeoutObject

Returns the value of attribute request_timeout.



5
6
7
# File 'lib/new_relic/agent/pipe_service.rb', line 5

def request_timeout
  @request_timeout
end

Instance Method Details

#connect(config) ⇒ Object



13
14
15
# File 'lib/new_relic/agent/pipe_service.rb', line 13

def connect(config)
  nil
end

#error_data(errors) ⇒ Object



30
31
32
# File 'lib/new_relic/agent/pipe_service.rb', line 30

def error_data(errors)
  write_to_pipe(:error_traces => errors) if errors
end

#get_agent_commandsObject



17
18
19
# File 'lib/new_relic/agent/pipe_service.rb', line 17

def get_agent_commands
  []
end

#metric_data(last_harvest_time, now, unsent_timeslice_data) ⇒ Object



21
22
23
24
# File 'lib/new_relic/agent/pipe_service.rb', line 21

def metric_data(last_harvest_time, now, unsent_timeslice_data)
  write_to_pipe(:stats => unsent_timeslice_data)
  {}
end

#reset_metric_id_cacheObject



50
51
52
# File 'lib/new_relic/agent/pipe_service.rb', line 50

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.



46
47
48
# File 'lib/new_relic/agent/pipe_service.rb', line 46

def session
  yield
end

#shutdown(time) ⇒ Object



38
39
40
41
# File 'lib/new_relic/agent/pipe_service.rb', line 38

def shutdown(time)
  write_to_pipe('EOF')
  NewRelic::Agent::PipeChannelManager.channels[@channel_id].close
end

#sql_trace_data(sql) ⇒ Object



34
35
36
# File 'lib/new_relic/agent/pipe_service.rb', line 34

def sql_trace_data(sql)
  write_to_pipe(:sql_traces => sql) if sql
end

#transaction_sample_data(transactions) ⇒ Object



26
27
28
# File 'lib/new_relic/agent/pipe_service.rb', line 26

def transaction_sample_data(transactions)
  write_to_pipe(:transaction_traces => transactions) if transactions
end