Class: NewRelic::Agent::Agent
- Inherits:
-
Object
- Object
- NewRelic::Agent::Agent
- Extended by:
- ClassMethods
- Includes:
- InstanceMethods, BrowserMonitoring
- 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
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
#beacon_configuration, #error_collector, #metric_ids, #obfuscator, #record_sql, #sql_sampler, #stats_engine, #transaction_sampler, #url_rules
Attributes included from InstanceMethods::Connect
#connect_attempts, #connect_retry_period
Instance Method Summary collapse
-
#initialize ⇒ Agent
constructor
A new instance of Agent.
Methods included from ClassMethods
Methods included from BrowserMonitoring
#browser_timing_footer, #browser_timing_header
Methods included from InstanceMethods
#after_fork, #connected?, #end_transaction, #log, #merge_data_from, #pop_trace_execution_flag, #push_trace_execution_flag, #record_transaction, #reset_stats, #serialize, #set_record_sql, #set_record_tt, #shutdown, #start, #start_transaction, #started?, #unsent_errors_size, #unsent_timeslice_data, #unsent_traces_size
Methods included from InstanceMethods::Connect
#apdex_f, #apdex_f_threshold?, #config_transaction_tracer, #configure_error_collector!, #configure_transaction_tracer!, #connect_settings, #connect_to_server, #disconnect, #enable_random_samples!, #environment_for_connect, #finish_setup, #get_retry_period, #handle_license_error, #increment_retry_period!, #log_connection!, #log_error, #log_seed_token, #log_sql_transmission_warning?, #query_server_for_configuration, #set_collector_host!, #set_sql_recording!, #should_keep_retrying?, #should_retry?, #tried_to_connect?, #validate_settings
Methods included from InstanceMethods::StartWorkerThread
#catch_errors, #check_sql_sampler_status, #check_transaction_sampler_status, #create_and_run_worker_loop, #deferred_work!, #handle_force_disconnect, #handle_force_restart, #handle_other_error, #handle_server_connection_problem, #log_worker_loop_start
Methods included from InstanceMethods::Start
#already_started?, #check_config_and_start_agent, #connect_in_foreground, #correct_license_length, #disabled?, #has_correct_license_key?, #has_license_key?, #install_exit_handler, #log_app_names, #log_dispatcher, #log_if, #log_unless, #log_version_and_pid, #monitoring?, #notify_log_file_location, #using_forking_dispatcher?, #using_sinatra?, #weird_ruby?
Constructor Details
#initialize ⇒ Agent
Returns a new instance of Agent.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/new_relic/agent/agent.rb', line 31 def initialize @launch_time = Time.now @metric_ids = {} @stats_engine = NewRelic::Agent::StatsEngine.new @transaction_sampler = NewRelic::Agent::TransactionSampler.new @sql_sampler = NewRelic::Agent::SqlSampler.new @stats_engine.transaction_sampler = @transaction_sampler @error_collector = NewRelic::Agent::ErrorCollector.new @connect_attempts = 0 @request_timeout = NewRelic::Control.instance.fetch('timeout', 2 * 60) @last_harvest_time = Time.now @obfuscator = lambda {|sql| NewRelic::Agent::Database.default_sql_obfuscator(sql) } end |