class Mmtrix::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 Mmtrix server.

Public Class Methods

config() click to toggle source
# File lib/mmtrix/agent/agent.rb, line 41
def self.config
  ::Mmtrix::Agent.config
end
new() click to toggle source
# File lib/mmtrix/agent/agent.rb, line 45
def initialize
  @started = false
  @event_loop = nil

  @service = MmtrixService.new

  @events                = Mmtrix::Agent::EventListener.new
  @stats_engine          = Mmtrix::Agent::StatsEngine.new
  @transaction_sampler   = Mmtrix::Agent::TransactionSampler.new
  @sql_sampler           = Mmtrix::Agent::SqlSampler.new
  @agent_command_router  = Mmtrix::Agent::Commands::AgentCommandRouter.new(@events)
  @cross_app_monitor     = Mmtrix::Agent::CrossAppMonitor.new(@events)
  @synthetics_monitor    = Mmtrix::Agent::SyntheticsMonitor.new(@events)
  @error_collector       = Mmtrix::Agent::ErrorCollector.new
  @transaction_rules     = Mmtrix::Agent::RulesEngine.new
  @harvest_samplers      = Mmtrix::Agent::SamplerCollection.new(@events)
  @monotonic_gc_profiler = Mmtrix::Agent::VM::MonotonicGCProfiler.new
  @javascript_instrumentor = Mmtrix::Agent::JavascriptInstrumentor.new(@events)

  @harvester       = Mmtrix::Agent::Harvester.new(@events)
  @after_fork_lock = Mutex.new

  @transaction_event_aggregator = Mmtrix::Agent::TransactionEventAggregator.new(@events)
  @custom_event_aggregator      = Mmtrix::Agent::CustomEventAggregator.new

  @connect_state      = :pending
  @connect_attempts   = 0
  @environment_report = nil

  @obfuscator = lambda {|sql| Mmtrix::Agent::Database.default_sql_obfuscator(sql) }

  setup_attribute_filter
end

Public Instance Methods

refresh_attribute_filter() click to toggle source
# File lib/mmtrix/agent/agent.rb, line 87
def refresh_attribute_filter
  @attribute_filter = Mmtrix::Agent::AttributeFilter.new(Mmtrix::Agent.config)
end
setup_attribute_filter() click to toggle source
# File lib/mmtrix/agent/agent.rb, line 79
def setup_attribute_filter
  refresh_attribute_filter

  @events.subscribe(:finished_configuring) do
    refresh_attribute_filter
  end
end