Class: Skywalking::Plugins::PluginsManager::SWPlugin

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

Direct Known Subclasses

Elasticsearch, Memcached, NetHttp, Redis5, Sinatra

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Log::Logging

#debug, #error, #info, #log, #warn

Constructor Details

#initializeSWPlugin



50
51
52
# File 'lib/skywalking/plugins_manager.rb', line 50

def initialize
  @installed = false
end

Class Method Details

.register(name, plugin_klass = self) ⇒ Object



46
47
48
# File 'lib/skywalking/plugins_manager.rb', line 46

def self.register(name, plugin_klass = self)
  Plugins::PluginsManager.register(name, plugin_klass.new)
end

Instance Method Details

#installObject

Raises:

  • (NotImplementedError)


78
79
80
# File 'lib/skywalking/plugins_manager.rb', line 78

def install
  raise NotImplementedError
end

#installed?Boolean



54
55
56
# File 'lib/skywalking/plugins_manager.rb', line 54

def installed?
  @installed
end

#plugin_valid?Boolean

Raises:

  • (NotImplementedError)


74
75
76
# File 'lib/skywalking/plugins_manager.rb', line 74

def plugin_valid?
  raise NotImplementedError
end

#try_install(name) ⇒ Object



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/skywalking/plugins_manager.rb', line 58

def try_install(name)
  info "try to install plugin #{name}"
  unless plugin_valid?
    warn "plugin validation failed for #{name}"
    return
  end
  return if installed?

  begin
    install
    @installed = true
  rescue => e
    error "try to install plugin %s failed, error=%s", name, e.message
  end
end