ganymed 0.4.3 → 0.4.4
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/.rvmrc +1 -1
- data/Gemfile +1 -1
- data/lib/ganymed/collector.rb +17 -7
- data/lib/ganymed/collectors/disk.rb +1 -1
- data/lib/ganymed/version.rb +1 -1
- metadata +5 -5
data/.rvmrc
CHANGED
@@ -1 +1 @@
|
|
1
|
-
rvm use --create ruby-1.9.3-
|
1
|
+
rvm use --create ruby-1.9.3-p392@ganymed
|
data/Gemfile
CHANGED
data/lib/ganymed/collector.rb
CHANGED
@@ -53,6 +53,7 @@ module Ganymed
|
|
53
53
|
collectors.each do |file|
|
54
54
|
name = File.basename(file, '.rb')
|
55
55
|
config = @config.collectors[name.to_sym] || Section.new
|
56
|
+
config.name = name
|
56
57
|
|
57
58
|
log.debug("loading collector #{name} from #{file}")
|
58
59
|
Plugin.new(config).from_file(file).tap do |collector|
|
@@ -90,6 +91,10 @@ module Ganymed
|
|
90
91
|
# @return [Fixnum,Float]
|
91
92
|
attr_accessor :interval
|
92
93
|
|
94
|
+
# Plugin splay
|
95
|
+
# @return [Fixnum]
|
96
|
+
attr_reader :splay
|
97
|
+
|
93
98
|
# Create a new plugin instance.
|
94
99
|
#
|
95
100
|
# @param [Section] config The configuration object.
|
@@ -103,6 +108,7 @@ module Ganymed
|
|
103
108
|
# @return [void]
|
104
109
|
def collect(interval=nil, &block)
|
105
110
|
@interval = interval || config.interval.tap{} || 1
|
111
|
+
@splay = 0
|
106
112
|
@collector = Proc.new(&block)
|
107
113
|
end
|
108
114
|
|
@@ -110,18 +116,22 @@ module Ganymed
|
|
110
116
|
# interval.
|
111
117
|
# @return [void]
|
112
118
|
def run
|
113
|
-
|
114
|
-
|
119
|
+
# we do not use a periodic timer here so that we can simply increase
|
120
|
+
# the splay to slow down the collector in case it throws lots of
|
121
|
+
# exceptions
|
122
|
+
EM.add_timer(interval * (2 ** splay)) do
|
123
|
+
EM.defer { collect!; run }
|
115
124
|
end
|
116
125
|
end
|
117
126
|
|
118
127
|
# @private
|
119
128
|
def collect!
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
129
|
+
@collector.call if @collector.is_a?(Proc)
|
130
|
+
@splay = 0
|
131
|
+
rescue Exception => exc
|
132
|
+
@splay += 1
|
133
|
+
log.exception(exc)
|
134
|
+
log.info("slowing down collector #{config.name}", interval: @interval, splay: @splay)
|
125
135
|
end
|
126
136
|
|
127
137
|
# Loads a given ruby file, and runs instance_eval against it in the
|
data/lib/ganymed/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ganymed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-03-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -222,7 +222,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
222
222
|
version: '0'
|
223
223
|
segments:
|
224
224
|
- 0
|
225
|
-
hash:
|
225
|
+
hash: -2160081704488403590
|
226
226
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
227
227
|
none: false
|
228
228
|
requirements:
|
@@ -231,10 +231,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
231
231
|
version: '0'
|
232
232
|
segments:
|
233
233
|
- 0
|
234
|
-
hash:
|
234
|
+
hash: -2160081704488403590
|
235
235
|
requirements: []
|
236
236
|
rubyforge_project:
|
237
|
-
rubygems_version: 1.8.
|
237
|
+
rubygems_version: 1.8.25
|
238
238
|
signing_key:
|
239
239
|
specification_version: 3
|
240
240
|
summary: Ganymed is a daemon that collects Metriks from third-party applications
|