class NewRelic::Agent::Agent
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.
Public Class Methods
Source
# File lib/new_relic/agent/agent.rb, line 58 def self.config ::NewRelic::Agent.config end
Source
# File lib/new_relic/agent/agent.rb, line 70 def initialize init_basics init_components init_event_handlers setup_attribute_filter end
Public Instance Methods
Source
# File lib/new_relic/agent/agent.rb, line 130 def refresh_attribute_filter @attribute_filter = AttributeFilter.new(Agent.config) end
Private Instance Methods
Source
# File lib/new_relic/agent/agent.rb, line 79 def init_basics @started = false @event_loop = nil @worker_thread = nil @connect_state = :pending @connect_attempts = 0 @waited_on_connect = nil @connected_pid = nil @wait_on_connect_mutex = Mutex.new @after_fork_lock = Mutex.new @wait_on_connect_condition = ConditionVariable.new end
Source
# File lib/new_relic/agent/agent.rb, line 92 def init_components @health_check = HealthCheck.new @service = NewRelicService.new @events = EventListener.new @stats_engine = StatsEngine.new @transaction_sampler = TransactionSampler.new @sql_sampler = SqlSampler.new @transaction_rules = RulesEngine.new @monotonic_gc_profiler = VM::MonotonicGCProfiler.new @adaptive_sampler = AdaptiveSampler.new(Agent.config[:sampling_target], Agent.config[:sampling_target_period_in_seconds]) @serverless_handler = ServerlessHandler.new @opentelemetry_bridge = OpenTelemetryBridge.new end
Source
# File lib/new_relic/agent/agent.rb, line 107 def init_event_handlers @agent_command_router = Commands::AgentCommandRouter.new(@events) @monitors = Monitors.new(@events) @error_collector = ErrorCollector.new(@events) @harvest_samplers = SamplerCollection.new(@events) @javascript_instrumentor = JavaScriptInstrumentor.new(@events) @harvester = Harvester.new(@events) @transaction_event_recorder = TransactionEventRecorder.new(@events) @custom_event_aggregator = CustomEventAggregator.new(@events) @span_event_aggregator = SpanEventAggregator.new(@events) @log_event_aggregator = LogEventAggregator.new(@events) end
Source
# File lib/new_relic/agent/agent.rb, line 120 def setup_attribute_filter refresh_attribute_filter @events.subscribe(:initial_configuration_complete) do refresh_attribute_filter end end