Class: NewRelic::Agent::Agent

Inherits:
Object
  • Object
show all
Extended by:
ClassMethods
Includes:
InstanceMethods
Defined in:
lib/new_relic/agent/agent.rb

Overview

The Agent is a singleton that is instantiated when the plugin is activated. It collects performance data from ruby applications in realtime as the application runs, and periodically sends that data to the NewRelic server.

Direct Known Subclasses

ShimAgent

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Constant Summary collapse

PROTOCOL_VERSION =

Specifies the version of the agent’s communication protocol with the NewRelic hosted site.

8

Instance Attribute Summary

Attributes included from InstanceMethods

#error_collector, #histogram, #metric_ids, #obfuscator, #record_sql, #stats_engine, #transaction_sampler, #url_rules

Instance Method Summary collapse

Methods included from ClassMethods

instance

Methods included from InstanceMethods

#after_fork, #connected?, #end_transaction, #log, #manual_start, #pop_trace_execution_flag, #push_trace_execution_flag, #record_transaction, #reset_stats, #set_record_sql, #set_record_tt, #set_sql_obfuscator, #shutdown, #start, #start_transaction, #started?

Constructor Details

#initializeAgent

Returns a new instance of Agent.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/new_relic/agent/agent.rb', line 30

def initialize

  @launch_time = Time.now

  @metric_ids = {}
  @histogram = NewRelic::Histogram.new(NewRelic::Control.instance.apdex_t / 10)
  @stats_engine = NewRelic::Agent::StatsEngine.new
  @transaction_sampler = NewRelic::Agent::TransactionSampler.new
  @stats_engine.transaction_sampler = @transaction_sampler
  @error_collector = NewRelic::Agent::ErrorCollector.new

  @request_timeout = NewRelic::Control.instance.fetch('timeout', 2 * 60)

  @last_harvest_time = Time.now
  @obfuscator = method(:default_sql_obfuscator)
end