fluent-plugin-metricsense 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.2.3
@@ -61,7 +61,7 @@ module Fluent
61
61
 
62
62
  config_param :backend, :string
63
63
 
64
- config_param :aggregate_interval, :integer, :default => 60
64
+ config_param :aggregate_interval, :time, :default => 60
65
65
 
66
66
  def configure(conf)
67
67
  super
@@ -85,6 +85,11 @@ module Fluent
85
85
  raise ConfigError, "unknown backend: #{@backend.inspect}"
86
86
  end
87
87
 
88
+ # aggregate_interval must be a multiple of 60 to normalize values
89
+ # into X per minute
90
+ @aggregate_interval = @aggregate_interval.to_i / 60 * 60
91
+ @normalize_factor = @aggregate_interval / 60
92
+
88
93
  @backend = be.new
89
94
  @backend.configure(conf)
90
95
  end
@@ -171,6 +176,10 @@ module Fluent
171
176
  end
172
177
  attr_reader :value
173
178
 
179
+ def normalized_value(n)
180
+ n == 1 ? @value : @value.to_f / n
181
+ end
182
+
174
183
  def add(value)
175
184
  @value += value
176
185
  end
@@ -186,6 +195,10 @@ module Fluent
186
195
  end
187
196
  attr_reader :value
188
197
 
198
+ def normalized_value(n)
199
+ @value
200
+ end
201
+
189
202
  def add(value)
190
203
  if @value < value
191
204
  @value = value
@@ -231,7 +244,7 @@ module Fluent
231
244
 
232
245
  data = []
233
246
  counters.each_pair {|ak,up|
234
- data << [ak.tag, ak.time, up.value, ak.seg_key, ak.seg_val, up.mode]
247
+ data << [ak.tag, ak.time, up.normalized_value(@normalize_factor), ak.seg_key, ak.seg_val, up.mode]
235
248
  }
236
249
 
237
250
  @backend.write(data)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-metricsense
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
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: 2013-08-03 00:00:00.000000000 Z
12
+ date: 2013-08-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd