Class: NewRelic::Agent::NewRelicService
- Inherits:
-
Object
- Object
- NewRelic::Agent::NewRelicService
- Defined in:
- lib/new_relic/agent/new_relic_service.rb
Constant Summary collapse
- PROTOCOL_VERSION =
Specifies the version of the agent’s communication protocol with the NewRelic hosted site.
8
Instance Attribute Summary collapse
-
#agent_id ⇒ Object
Returns the value of attribute agent_id.
-
#collector ⇒ Object
readonly
Returns the value of attribute collector.
-
#request_timeout ⇒ Object
14105: v8 (tag 2.10.3) (no v7) 10379: v6 (not tagged) 4078: v5 (tag 2.5.4) 2292: v4 (tag 2.3.6) 1754: v3 (tag 2.3.0) 534: v2 (shows up in 2.1.0, our first tag).
Instance Method Summary collapse
- #connect(settings = {}) ⇒ Object
- #error_data(unsent_errors) ⇒ Object
- #get_redirect_host ⇒ Object
-
#initialize(license_key = control.license_key, collector = control.server) ⇒ NewRelicService
constructor
A new instance of NewRelicService.
- #metric_data(last_harvest_time, now, unsent_timeslice_data) ⇒ Object
- #shutdown(time) ⇒ Object
- #sql_trace_data(sql_traces) ⇒ Object
- #transaction_sample_data(traces) ⇒ Object
Constructor Details
#initialize(license_key = control.license_key, collector = control.server) ⇒ NewRelicService
Returns a new instance of NewRelicService.
20 21 22 23 24 |
# File 'lib/new_relic/agent/new_relic_service.rb', line 20 def initialize(license_key=control.license_key, collector=control.server) @license_key = license_key @collector = collector @request_timeout = NewRelic::Control.instance.fetch('timeout', 2 * 60) end |
Instance Attribute Details
#agent_id ⇒ Object
Returns the value of attribute agent_id.
18 19 20 |
# File 'lib/new_relic/agent/new_relic_service.rb', line 18 def agent_id @agent_id end |
#collector ⇒ Object (readonly)
Returns the value of attribute collector.
17 18 19 |
# File 'lib/new_relic/agent/new_relic_service.rb', line 17 def collector @collector end |
#request_timeout ⇒ Object
14105: v8 (tag 2.10.3) (no v7) 10379: v6 (not tagged) 4078: v5 (tag 2.5.4) 2292: v4 (tag 2.3.6) 1754: v3 (tag 2.3.0) 534: v2 (shows up in 2.1.0, our first tag)
16 17 18 |
# File 'lib/new_relic/agent/new_relic_service.rb', line 16 def request_timeout @request_timeout end |
Instance Method Details
#connect(settings = {}) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/new_relic/agent/new_relic_service.rb', line 26 def connect(settings={}) if host = get_redirect_host @collector = NewRelic::Control.instance.server_from_host(host) end response = invoke_remote(:connect, settings) @agent_id = response['agent_run_id'] response end |
#error_data(unsent_errors) ⇒ Object
48 49 50 |
# File 'lib/new_relic/agent/new_relic_service.rb', line 48 def error_data(unsent_errors) invoke_remote(:error_data, @agent_id, unsent_errors) end |
#get_redirect_host ⇒ Object
35 36 37 |
# File 'lib/new_relic/agent/new_relic_service.rb', line 35 def get_redirect_host invoke_remote(:get_redirect_host) end |
#metric_data(last_harvest_time, now, unsent_timeslice_data) ⇒ Object
43 44 45 46 |
# File 'lib/new_relic/agent/new_relic_service.rb', line 43 def metric_data(last_harvest_time, now, unsent_timeslice_data) invoke_remote(:metric_data, @agent_id, last_harvest_time, now, unsent_timeslice_data) end |
#shutdown(time) ⇒ Object
39 40 41 |
# File 'lib/new_relic/agent/new_relic_service.rb', line 39 def shutdown(time) invoke_remote(:shutdown, @agent_id, time) if @agent_id end |
#sql_trace_data(sql_traces) ⇒ Object
56 57 58 |
# File 'lib/new_relic/agent/new_relic_service.rb', line 56 def sql_trace_data(sql_traces) invoke_remote(:sql_trace_data, sql_traces) end |
#transaction_sample_data(traces) ⇒ Object
52 53 54 |
# File 'lib/new_relic/agent/new_relic_service.rb', line 52 def transaction_sample_data(traces) invoke_remote(:transaction_sample_data, @agent_id, traces) end |