Class: Skywalking::Plugins::PluginsManager

Inherits:
Object
  • Object
show all
Defined in:
lib/skywalking/plugins_manager.rb

Defined Under Namespace

Classes: SWPlugin

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ PluginsManager

Returns a new instance of PluginsManager.



29
30
31
# File 'lib/skywalking/plugins_manager.rb', line 29

def initialize(config)
  @config = config
end

Class Method Details

.installedObject



24
25
26
# File 'lib/skywalking/plugins_manager.rb', line 24

def installed
  @installed ||= {}
end

.register(name, plugin_klass) ⇒ Object



20
21
22
# File 'lib/skywalking/plugins_manager.rb', line 20

def register(name, plugin_klass)
  installed[name] = plugin_klass
end

Instance Method Details

#init_pluginsObject



33
34
35
36
37
38
39
40
41
# File 'lib/skywalking/plugins_manager.rb', line 33

def init_plugins
  Dir[File.join(__dir__, 'plugins', '*.rb')].each { |file| require file }

  installed_plugins = self.class.installed.keys
  @enabled_plugins ||= installed_plugins - @config[:disable_plugins].split(',').map(&:to_sym)
  @enabled_plugins.each do |plugin_name|
    self.class.installed[plugin_name].try_install(plugin_name)
  end
end