lib/new_relic/agent/agent.rb in newrelic_rpm-4.5.0.337 vs lib/new_relic/agent/agent.rb in newrelic_rpm-4.6.0.338

- old
+ new

@@ -17,20 +17,22 @@ require 'new_relic/agent/configuration/manager' require 'new_relic/agent/database' require 'new_relic/agent/commands/agent_command_router' require 'new_relic/agent/event_listener' require 'new_relic/agent/cross_app_monitor' +require 'new_relic/agent/distributed_trace_monitor' require 'new_relic/agent/synthetics_monitor' require 'new_relic/agent/synthetics_event_buffer' require 'new_relic/agent/transaction_event_recorder' require 'new_relic/agent/custom_event_aggregator' require 'new_relic/agent/sampler_collection' require 'new_relic/agent/javascript_instrumentor' require 'new_relic/agent/vm/monotonic_gc_profiler' require 'new_relic/agent/utilization_data' require 'new_relic/environment_report' require 'new_relic/agent/attribute_filter' +require 'new_relic/agent/throughput_monitor' module NewRelic module Agent # The Agent is a singleton that is instantiated when the plugin is @@ -46,22 +48,24 @@ @started = false @event_loop = nil @service = NewRelicService.new - @events = NewRelic::Agent::EventListener.new - @stats_engine = NewRelic::Agent::StatsEngine.new - @transaction_sampler = NewRelic::Agent::TransactionSampler.new - @sql_sampler = NewRelic::Agent::SqlSampler.new - @agent_command_router = NewRelic::Agent::Commands::AgentCommandRouter.new(@events) - @cross_app_monitor = NewRelic::Agent::CrossAppMonitor.new(@events) - @synthetics_monitor = NewRelic::Agent::SyntheticsMonitor.new(@events) - @error_collector = NewRelic::Agent::ErrorCollector.new - @transaction_rules = NewRelic::Agent::RulesEngine.new - @harvest_samplers = NewRelic::Agent::SamplerCollection.new(@events) - @monotonic_gc_profiler = NewRelic::Agent::VM::MonotonicGCProfiler.new - @javascript_instrumentor = NewRelic::Agent::JavascriptInstrumentor.new(@events) + @events = NewRelic::Agent::EventListener.new + @stats_engine = NewRelic::Agent::StatsEngine.new + @transaction_sampler = NewRelic::Agent::TransactionSampler.new + @sql_sampler = NewRelic::Agent::SqlSampler.new + @agent_command_router = NewRelic::Agent::Commands::AgentCommandRouter.new(@events) + @cross_app_monitor = NewRelic::Agent::CrossAppMonitor.new(@events) + @distributed_trace_monitor = NewRelic::Agent::DistributedTraceMonitor.new(@events) + @synthetics_monitor = NewRelic::Agent::SyntheticsMonitor.new(@events) + @error_collector = NewRelic::Agent::ErrorCollector.new + @transaction_rules = NewRelic::Agent::RulesEngine.new + @harvest_samplers = NewRelic::Agent::SamplerCollection.new(@events) + @monotonic_gc_profiler = NewRelic::Agent::VM::MonotonicGCProfiler.new + @javascript_instrumentor = NewRelic::Agent::JavascriptInstrumentor.new(@events) + @throughput_monitor = NewRelic::Agent::ThroughputMonitor.new @harvester = NewRelic::Agent::Harvester.new(@events) @after_fork_lock = Mutex.new @transaction_event_recorder = NewRelic::Agent::TransactionEventRecorder.new @@ -138,10 +142,11 @@ # GC::Profiler.total_time is not monotonic so we wrap it. attr_reader :monotonic_gc_profiler attr_reader :custom_event_aggregator attr_reader :transaction_event_recorder attr_reader :attribute_filter + attr_reader :throughput_monitor def transaction_event_aggregator @transaction_event_recorder.transaction_event_aggregator end @@ -541,10 +546,11 @@ @error_collector.drop_buffered_data @transaction_sampler.reset! @transaction_event_recorder.drop_buffered_data @custom_event_aggregator.reset! @sql_sampler.reset! + if Agent.config[:clear_transaction_state_after_fork] TransactionState.tl_clear end end @@ -1146,9 +1152,10 @@ check_for_and_handle_agent_commands harvest_and_send_for_agent_commands end ensure + throughput_monitor.reset! NewRelic::Agent::Database.close_connections duration = (Time.now - now).to_f NewRelic::Agent.record_metric('Supportability/Harvest', duration) end