Class: NewRelic::Agent::Agent
- Inherits:
-
Object
- Object
- NewRelic::Agent::Agent
- Extended by:
- ClassMethods, Configuration::Instance
- 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
Instance Attribute Summary
Attributes included from InstanceMethods
#beacon_configuration, #cross_app_encoding_bytes, #cross_app_monitor, #cross_process_id, #error_collector, #events, #harvest_samplers, #metric_rules, #obfuscator, #record_sql, #service, #sql_sampler, #stats_engine, #thread_profiler, #transaction_rules, #transaction_sampler
Attributes included from InstanceMethods::Connect
Instance Method Summary collapse
-
#initialize ⇒ Agent
constructor
A new instance of Agent.
Methods included from Configuration::Instance
Methods included from ClassMethods
Methods included from BrowserMonitoring
beacon_url, browser_monitoring_app_time, browser_monitoring_queue_time, browser_monitoring_start_time, browser_monitoring_transaction_name, #browser_timing_footer, #browser_timing_header, clamp_to_positive, current_transaction, insert_mobile_response_header, mobile_header_found_in?, obfuscate, timings
Methods included from InstanceMethods
#add_harvest_sampler, #after_fork, #agent_should_start?, #end_transaction, #merge_data_from, #pop_trace_execution_flag, #push_trace_execution_flag, #record_transaction, #reset_objects_with_locks, #reset_stats, #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
#add_rules_to_engine, #apdex_f, #connect_retry_period, #connect_settings, #connect_to_server, #connected?, #disconnect, #disconnected?, #environment_for_connect, #finish_setup, #generate_environment_report, #handle_license_error, #handle_unrecoverable_agent_error, #log_collector_messages, #log_connection!, #log_error, #note_connect_failure, #query_server_for_configuration, #should_connect?
Methods included from InstanceMethods::StartWorkerThread
#catch_errors, #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?, #app_name_configured?, #check_config_and_start_agent, #connect_in_foreground, #correct_license_length, #defer_for_resque?, #disabled?, #has_correct_license_key?, #has_license_key?, #install_exit_handler, #log_app_name, #log_dispatcher, #log_environment, #log_if, #log_startup, #log_unless, #log_version_and_pid, #monitoring?, #using_forking_dispatcher?, #using_sinatra?, #weird_ruby?
Constructor Details
#initialize ⇒ Agent
Returns a new instance of Agent.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/new_relic/agent/agent.rb', line 33 def initialize @launch_time = Time.now @events = NewRelic::Agent::EventListener.new @stats_engine = NewRelic::Agent::StatsEngine.new @transaction_sampler = NewRelic::Agent::TransactionSampler.new @sql_sampler = NewRelic::Agent::SqlSampler.new @thread_profiler = NewRelic::Agent::ThreadProfiler.new @cross_app_monitor = NewRelic::Agent::CrossAppMonitor.new(@events) @error_collector = NewRelic::Agent::ErrorCollector.new @transaction_rules = NewRelic::Agent::RulesEngine.new @metric_rules = NewRelic::Agent::RulesEngine.new @request_sampler = NewRelic::Agent::RequestSampler.new(@events) @harvest_samplers = NewRelic::Agent::SamplerCollection.new(@events) @connect_state = :pending @connect_attempts = 0 @environment_report = nil @last_harvest_time = Time.now @obfuscator = lambda {|sql| NewRelic::Agent::Database.default_sql_obfuscator(sql) } # FIXME: temporary work around for RUBY-839 # This should be handled with a configuration callback if Agent.config[:monitor_mode] @service = NewRelic::Agent::NewRelicService.new end end |