lib/new_relic/agent/agent.rb in newrelic_rpm-6.7.0.359 vs lib/new_relic/agent/agent.rb in newrelic_rpm-6.8.0.360

- old
+ new

@@ -17,10 +17,11 @@ 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/trace_context_request_monitor' require 'new_relic/agent/synthetics_monitor' require 'new_relic/agent/transaction_event_recorder' require 'new_relic/agent/custom_event_aggregator' require 'new_relic/agent/span_event_aggregator' require 'new_relic/agent/sampler_collection' @@ -56,10 +57,11 @@ @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) + @trace_context_monitor = NewRelic::Agent::TraceContextRequestMonitor.new(@events) @synthetics_monitor = NewRelic::Agent::SyntheticsMonitor.new(@events) @error_collector = NewRelic::Agent::ErrorCollector.new @events @transaction_rules = NewRelic::Agent::RulesEngine.new @harvest_samplers = NewRelic::Agent::SamplerCollection.new(@events) @monotonic_gc_profiler = NewRelic::Agent::VM::MonotonicGCProfiler.new @@ -145,10 +147,11 @@ attr_reader :custom_event_aggregator attr_reader :span_event_aggregator attr_reader :transaction_event_recorder attr_reader :attribute_filter attr_reader :adaptive_sampler + attr_reader :environment_report def transaction_event_aggregator @transaction_event_recorder.transaction_event_aggregator end @@ -480,10 +483,11 @@ @started = true @harvester.mark_started unless in_resque_child_process? install_exit_handler + environment_for_connect @harvest_samplers.load_samplers unless Agent.config[:disable_samplers] end connect_in_foreground if Agent.config[:sync_startup] start_worker_thread(options) @@ -787,11 +791,11 @@ # returns the snapshot from the local environment. # Generating the EnvironmentReport has the potential to trigger # require calls in Rails environments, so this method should only # be called synchronously from on the main thread. def environment_for_connect - Agent.config[:send_environment_info] ? Array(EnvironmentReport.new) : [] + @environment_report ||= Agent.config[:send_environment_info] ? Array(EnvironmentReport.new) : [] end # Constructs and memoizes an event_harvest_config hash to be used in # the payload sent during connect (and reconnect) def event_harvest_config @@ -803,10 +807,11 @@ # the connect service def connect_to_server request_builder = ::NewRelic::Agent::Connect::RequestBuilder.new \ @service, Agent.config, - event_harvest_config + event_harvest_config, + environment_for_connect connect_response = @service.connect request_builder.connect_payload response_handler = ::NewRelic::Agent::Connect::ResponseHandler.new(self, Agent.config) response_handler.configure_agent(connect_response)