Class: NewRelic::Plugin::AgentSetup
- Inherits:
-
Object
- Object
- NewRelic::Plugin::AgentSetup
- Defined in:
- lib/newrelic_plugin/setup.rb
Overview
Setup and instantiate new agent instances (of agent type previously setup in NewRelic::Plugin::Setup)
Instance Attribute Summary collapse
-
#agents ⇒ Object
readonly
Returns the value of attribute agents.
Instance Method Summary collapse
- #create_agent(context, ident, options = nil, &block) ⇒ Object
-
#initialize ⇒ AgentSetup
constructor
A new instance of AgentSetup.
Constructor Details
#initialize ⇒ AgentSetup
Returns a new instance of AgentSetup.
31 32 33 |
# File 'lib/newrelic_plugin/setup.rb', line 31 def initialize @agents = [] end |
Instance Attribute Details
#agents ⇒ Object (readonly)
Returns the value of attribute agents.
30 31 32 |
# File 'lib/newrelic_plugin/setup.rb', line 30 def agents @agents end |
Instance Method Details
#create_agent(context, ident, options = nil, &block) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/newrelic_plugin/setup.rb', line 34 def create_agent context, ident, = nil, &block agent_info = Setup.installed_agents[ident] raise UnknownInstalledAgent,"Unrecognized agent '#{ident}'" unless agent_info agent = agent_info[:agent_class].new context, raise CouldNotInitializeAgent unless agent block.call(agent) if block_given? context.version = agent.version @agents << agent end |