riemann-babbler 0.6.4 → 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/riemann-babbler +5 -4
- data/lib/riemann/version.rb +1 -1
- data/lib/start_helpers.rb +19 -4
- metadata +2 -2
data/bin/riemann-babbler
CHANGED
@@ -28,8 +28,9 @@ end
|
|
28
28
|
logger = Logger.new(STDOUT)
|
29
29
|
|
30
30
|
# start_helpers
|
31
|
-
merge_config(logger, opts, configatron)
|
32
|
-
set_logger_lvl(logger, configatron)
|
33
|
-
load_plugins(configatron)
|
34
|
-
riemann = get_riemann(configatron)
|
31
|
+
merge_config( logger, opts, configatron )
|
32
|
+
set_logger_lvl( logger, configatron )
|
33
|
+
load_plugins( configatron )
|
34
|
+
riemann = get_riemann( configatron )
|
35
|
+
load_parent( configatron )
|
35
36
|
start_plugins( Riemann::Babbler.registered_plugins, riemann, logger, configatron )
|
data/lib/riemann/version.rb
CHANGED
data/lib/start_helpers.rb
CHANGED
@@ -71,13 +71,11 @@ end
|
|
71
71
|
# логика стартования плагинов
|
72
72
|
def start_plugins(registered_plugins, riemann, logger, configatron)
|
73
73
|
|
74
|
-
plugins_for_run = registered_plugins
|
75
|
-
|
76
74
|
if run_only = configatron.plugins.run_only
|
77
|
-
|
75
|
+
registered_plugins.delete_if {|plugin| ! run_only.include? plugin.to_s.split("::").last.downcase }
|
78
76
|
end unless ( configatron.plugins.run_only.nil? || configatron.plugins.run_only.empty? )
|
79
77
|
|
80
|
-
plugin_threads =
|
78
|
+
plugin_threads = registered_plugins.map do |plugin|
|
81
79
|
Thread.new {
|
82
80
|
plugin.new( configatron, logger, riemann ).run
|
83
81
|
}
|
@@ -90,3 +88,20 @@ def start_plugins(registered_plugins, riemann, logger, configatron)
|
|
90
88
|
|
91
89
|
plugin_threads.each( &:join )
|
92
90
|
end
|
91
|
+
|
92
|
+
def load_parent(configatron)
|
93
|
+
configatron.to_hash[:plugins].each do |plugin, opts|
|
94
|
+
next if opts.nil?
|
95
|
+
next unless opts.kind_of? Hash
|
96
|
+
create_class(plugin.capitalize, opts[:parent].capitalize) if opts.has_key? :parent
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
# plugin load parent
|
101
|
+
def create_class(new_class, parent_class)
|
102
|
+
cmd = "class Riemann::Babbler::#{new_class} < Riemann::Babbler::#{parent_class}; end;"
|
103
|
+
cmd += "Riemann::Babbler.registered_plugins << Riemann::Babbler::#{new_class}"
|
104
|
+
eval(cmd)
|
105
|
+
end
|
106
|
+
|
107
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riemann-babbler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -165,7 +165,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
165
165
|
version: '0'
|
166
166
|
segments:
|
167
167
|
- 0
|
168
|
-
hash: -
|
168
|
+
hash: -3547956697468035733
|
169
169
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
170
|
none: false
|
171
171
|
requirements:
|