ganymed 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,10 +16,10 @@ collect do
16
16
  next if config.exclude.map {|e| Regexp.new(e).match(name)}.any?
17
17
 
18
18
  block_pc = 1.0 - (st.blocks_free.to_f / st.blocks.to_f)
19
- processor.event("os.disk.#{name}.blocks", block_pc)
19
+ sampler.emit(:gauge, "os.disk.#{name}.blocks", block_pc)
20
20
 
21
21
  files_pc = 1.0 - (st.files_free.to_f / st.files.to_f)
22
- processor.event("os.disk.#{name}.files", files_pc)
22
+ sampler.emit(:gauge, "os.disk.#{name}.files", files_pc)
23
23
  end
24
24
  end
25
25
  end
@@ -1,4 +1,4 @@
1
- collect do
1
+ collect(900) do
2
2
  next if not File.readable?('/proc/stat')
3
3
  File.open('/proc/stat') do |file|
4
4
  file.each do |line|
@@ -44,22 +44,22 @@ module Ganymed
44
44
  #
45
45
  # @return [Event] The parsed event instance.
46
46
  def self.parse(obj)
47
- new.tap do |event|
48
- event.ns = obj['n']
49
- event.cf = obj['c']
50
- event.origin = obj['o']
51
- event.timestamp = obj['t'].to_i
52
- event.resolution = obj['r'].to_i
47
+ event = new
48
+ event.ns = obj['n']
49
+ event.cf = obj['c']
50
+ event.origin = obj['o']
51
+ event.timestamp = obj['t'].to_i
52
+ event.resolution = obj['r'].to_i
53
53
 
54
- value = obj['v']
55
- if value.is_a?(Float) and (value.nan? or value.infinite?)
56
- event.value = nil
57
- else
58
- event.value = value
59
- end
60
-
61
- event.validate
54
+ value = obj['v']
55
+ if value.is_a?(Float) and (value.nan? or value.infinite?)
56
+ event.value = nil
57
+ else
58
+ event.value = value
62
59
  end
60
+
61
+ event.validate
62
+ event
63
63
  end
64
64
 
65
65
  # Convert this event into a hash with long keys. This hash cannot be parsed
@@ -81,7 +81,7 @@ module Ganymed
81
81
  #
82
82
  # @return [void]
83
83
  def validate
84
- unless @ns =~ /^[a-z][a-z0-9_\.-]+[a-z0-9]$/
84
+ unless @ns =~ /^[a-z][a-z0-9_\.-]+[a-z0-9]$/i
85
85
  raise "invalid namespace: #{@ns.inspect}"
86
86
  end
87
87
 
@@ -12,8 +12,7 @@ module Ganymed
12
12
  end
13
13
 
14
14
  def connection
15
- @connection ||= ::Mongo::Connection.new(config.host,
16
- config.port,
15
+ @connection ||= ::Mongo::Connection.new(config.host, config.port,
17
16
  :pool_size => config.pool_size,
18
17
  :pool_timeout => config.pool_timeout)
19
18
  end
@@ -23,18 +22,19 @@ module Ganymed
23
22
  end
24
23
 
25
24
  def collection(ns)
26
- @collections[ns] ||= db[ns].tap do |col|
27
- col.ensure_index([['c', ::Mongo::ASCENDING]])
28
- col.ensure_index([['o', ::Mongo::ASCENDING]])
29
- col.ensure_index([['t', ::Mongo::ASCENDING]])
30
- col.ensure_index([['c', ::Mongo::ASCENDING], ['o', ::Mongo::ASCENDING]])
31
- col.ensure_index([['o', ::Mongo::ASCENDING], ['t', ::Mongo::ASCENDING]])
32
- col.ensure_index([['c', ::Mongo::ASCENDING], ['o', ::Mongo::ASCENDING], ['t', ::Mongo::ASCENDING]], :unique => true)
33
- end
25
+ return @collections[ns] if @collections.has_key?(ns)
26
+ col = @collections[ns] = db.collection(ns)
27
+ col.ensure_index([['c', ::Mongo::ASCENDING]])
28
+ col.ensure_index([['o', ::Mongo::ASCENDING]])
29
+ col.ensure_index([['t', ::Mongo::ASCENDING]])
30
+ col.ensure_index([['c', ::Mongo::ASCENDING], ['o', ::Mongo::ASCENDING]])
31
+ col.ensure_index([['o', ::Mongo::ASCENDING], ['t', ::Mongo::ASCENDING]])
32
+ col.ensure_index([['c', ::Mongo::ASCENDING], ['o', ::Mongo::ASCENDING], ['t', ::Mongo::ASCENDING]], :unique => true)
33
+ col
34
34
  end
35
35
 
36
- def method_missing(method, *args, &block)
37
- db.__send__(method, *args, &block)
36
+ def [](*args)
37
+ db.collection(*args)
38
38
  end
39
39
  end
40
40
  end
@@ -1,4 +1,4 @@
1
1
  module Ganymed
2
2
  # @private
3
- VERSION = '0.3.1'
3
+ VERSION = '0.3.2'
4
4
  end
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.3.1
4
+ version: 0.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-27 00:00:00.000000000 Z
12
+ date: 2012-06-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &7558920 !ruby/object:Gem::Requirement
16
+ requirement: &10346400 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '3.2'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *7558920
24
+ version_requirements: *10346400
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: eventmachine
27
- requirement: &7557220 !ruby/object:Gem::Requirement
27
+ requirement: &10345340 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.12.10
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *7557220
35
+ version_requirements: *10345340
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: ganymed-client
38
- requirement: &7555900 !ruby/object:Gem::Requirement
38
+ requirement: &10344700 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.2.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *7555900
46
+ version_requirements: *10344700
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: madvertise-ext
49
- requirement: &7554720 !ruby/object:Gem::Requirement
49
+ requirement: &10343960 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.1.2
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *7554720
57
+ version_requirements: *10343960
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: madvertise-logging
60
- requirement: &7553740 !ruby/object:Gem::Requirement
60
+ requirement: &10362800 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 0.3.2
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *7553740
68
+ version_requirements: *10362800
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: mixlib-cli
71
- requirement: &7553220 !ruby/object:Gem::Requirement
71
+ requirement: &10362360 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *7553220
79
+ version_requirements: *10362360
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: RubyInline
82
- requirement: &7567900 !ruby/object:Gem::Requirement
82
+ requirement: &10361580 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *7567900
90
+ version_requirements: *10361580
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: servolux
93
- requirement: &7566640 !ruby/object:Gem::Requirement
93
+ requirement: &10361080 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *7566640
101
+ version_requirements: *10361080
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: msgpack
104
- requirement: &7564920 !ruby/object:Gem::Requirement
104
+ requirement: &10383460 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :runtime
111
111
  prerelease: false
112
- version_requirements: *7564920
112
+ version_requirements: *10383460
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: mongo
115
- requirement: &7562960 !ruby/object:Gem::Requirement
115
+ requirement: &10381520 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: '1.6'
121
121
  type: :runtime
122
122
  prerelease: false
123
- version_requirements: *7562960
123
+ version_requirements: *10381520
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: em-websocket
126
- requirement: &7561620 !ruby/object:Gem::Requirement
126
+ requirement: &10380040 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ! '>='
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: '0'
132
132
  type: :runtime
133
133
  prerelease: false
134
- version_requirements: *7561620
134
+ version_requirements: *10380040
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: yajl-ruby
137
- requirement: &7592340 !ruby/object:Gem::Requirement
137
+ requirement: &10377140 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ! '>='
@@ -142,10 +142,10 @@ dependencies:
142
142
  version: '0'
143
143
  type: :runtime
144
144
  prerelease: false
145
- version_requirements: *7592340
145
+ version_requirements: *10377140
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: sys-filesystem
148
- requirement: &7591700 !ruby/object:Gem::Requirement
148
+ requirement: &10398540 !ruby/object:Gem::Requirement
149
149
  none: false
150
150
  requirements:
151
151
  - - ! '>='
@@ -153,10 +153,10 @@ dependencies:
153
153
  version: '0'
154
154
  type: :runtime
155
155
  prerelease: false
156
- version_requirements: *7591700
156
+ version_requirements: *10398540
157
157
  - !ruby/object:Gem::Dependency
158
158
  name: ohai
159
- requirement: &7590960 !ruby/object:Gem::Requirement
159
+ requirement: &10394740 !ruby/object:Gem::Requirement
160
160
  none: false
161
161
  requirements:
162
162
  - - ! '>='
@@ -164,7 +164,7 @@ dependencies:
164
164
  version: 0.6.12
165
165
  type: :runtime
166
166
  prerelease: false
167
- version_requirements: *7590960
167
+ version_requirements: *10394740
168
168
  description: Ganymed is an event collection daemon
169
169
  email:
170
170
  - bb@xnull.de
@@ -239,7 +239,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
239
239
  version: '0'
240
240
  segments:
241
241
  - 0
242
- hash: -4196854861267997123
242
+ hash: -2621061982868671869
243
243
  required_rubygems_version: !ruby/object:Gem::Requirement
244
244
  none: false
245
245
  requirements:
@@ -248,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
248
  version: '0'
249
249
  segments:
250
250
  - 0
251
- hash: -4196854861267997123
251
+ hash: -2621061982868671869
252
252
  requirements: []
253
253
  rubyforge_project:
254
254
  rubygems_version: 1.8.17