Sha256: 847ae6d288b624f83b86511fcfbb3b6a2a20fef85eb6e5e3973134f9a8e523a6
Contents?: true
Size: 1.16 KB
Versions: 3
Compression:
Stored size: 1.16 KB
Contents
module NewRelic module Plugin # # Setup support methods. # # # Setup and Register new agent types and new processors # class Setup class << self def install_agent ident, klass @installed_agents ||= {} @installed_agents[ident] = { :agent_class => klass::Agent, :label => klass::Agent.label, :ident => ident } end def installed_agents @installed_agents || {} end end end # # Setup and instantiate new agent instances (of agent type previously setup in NewRelic::Plugin::Setup) # class AgentSetup attr_reader :agents def initialize @agents = [] end def create_agent context, ident, options = nil, &block agent_info = Setup.installed_agents[ident] raise UnknownInstalledAgent,"Unrecognized agent '#{ident}'" unless agent_info agent = agent_info[:agent_class].new context, options raise CouldNotInitializeAgent unless agent block.call(agent) if block_given? context.version = agent.version @agents << agent end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
newrelic_plugin-1.3.1 | lib/newrelic_plugin/setup.rb |
newrelic_plugin-1.3.0 | lib/newrelic_plugin/setup.rb |
newrelic_plugin-1.2.1 | lib/newrelic_plugin/setup.rb |