fluent-plugin-metricsense 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 87384bad8d55efdb43f5f68b3d66bcfdce31a003
4
- data.tar.gz: 2efa753e4a092052ff567fd014d8004804cd5b1e
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZTQwODg5MWU4OTUwMWMyZjg3ZGViYmQxNDZjZTU3YjM5OGZkYmFhNw==
5
+ data.tar.gz: !binary |-
6
+ ZjEyM2NjYzQ5NjZjM2YzODBkMjg2MzcwODgwMjIyYzNjNzdkODI0Mw==
5
7
  SHA512:
6
- metadata.gz: 99f6c382071ca9e4d26fefa8c3227d5558718750b6287c2eed7102e96c53aad1a6367271dc85d21aaf2b8f5b14773f0fbb90ade4eea4e4074d8263f90551e890
7
- data.tar.gz: 0a42690cde3a828784025d0bbc914a4f23b8ac7ef0ff93bfc3ef4375651a5cac6953d988b0346f4d84360a5e2b0cba1d57eeac1c9c89b932defc10e14c126ffe
8
+ metadata.gz: !binary |-
9
+ NjJjOWY0ZWE2ZjNkNGMxNzBkOGM5ZWQ5YzZjMzEzNjBkOGE3ZDg4MGFlMWFk
10
+ M2ZjNDNlYmZmYTM4YjdmOGQ0MDcwYWI0MTU5NGY5YjY1NGRkNDkxYTU2NTVm
11
+ NThmOGNmN2ZmMjEyM2RhYzgwMGZlMGNjNzlmZTQ1NTllMmE3ZjA=
12
+ data.tar.gz: !binary |-
13
+ MTJlNmY0YmQ4ZWYzYTg4MTUyNjYwYmEwMGYwYmJjYzQ1NDVmZmIyZGI5ZjA1
14
+ YjNkNjk4ZTA4MzBiYzQ1YjIzMmJlZDZiZjVlYzAxNjEwMmIxMTY4YzA1YTBl
15
+ Mzc5MGY3ZjJmOWQwNDMwNzBmNDgyMjc2OGY3ODBiYmFmZDg1YWU=
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.5
1
+ 0.2.6
@@ -228,10 +228,20 @@ module Fluent
228
228
  end
229
229
  end
230
230
 
231
+ class SegmentedTotalUpdater < AddUpdater
232
+ def initialize(original_mode)
233
+ super()
234
+ @mode = original_mode
235
+ end
236
+
237
+ attr_reader :mode
238
+ end
239
+
231
240
  AggregationKey = Struct.new(:tag, :time, :seg_val, :seg_key)
232
241
 
233
242
  def write(chunk)
234
- counters = {}
243
+ simple_counters = {}
244
+ segmented_counters = {}
235
245
 
236
246
  # select sum(value) from chunk group by tag, time/60, seg_val, seg_key
237
247
  chunk.msgpack_each {|tag,time,value,segments,update_mode|
@@ -248,21 +258,34 @@ module Fluent
248
258
  updater = AddUpdater
249
259
  end
250
260
 
251
- # total value
252
- ak = AggregationKey.new(tag, time, nil, nil)
253
- (counters[ak] ||= updater.new).add(value)
254
-
255
- # segmented values
256
- segments = Hash[segments] if segments.is_a?(Array) # for backward compat
261
+ if segments.empty?
262
+ # simple values
263
+ ak = AggregationKey.new(tag, time, nil, nil)
264
+ (simple_counters[ak] ||= updater.new).add(value)
265
+ else
266
+ # segmented values
267
+ segments.each_pair {|seg_key,seg_val|
268
+ ak = AggregationKey.new(tag, time, seg_val, seg_key)
269
+ (segmented_counters[ak] ||= updater.new).add(value)
270
+ }
271
+ end
272
+ }
257
273
 
258
- segments.each_pair {|seg_key,seg_val|
259
- ak = AggregationKey.new(tag, time, seg_val, seg_key)
260
- (counters[ak] ||= updater.new).add(value)
261
- }
274
+ # calculate total value of segmented values
275
+ segmented_totals = {}
276
+ segmented_counters.each_pair {|ak,up|
277
+ ak = AggregationKey.new(ak.tag, ak.time, nil, nil)
278
+ (segmented_totals[ak] ||= SegmentedTotalUpdater.new(up.mode)).add(up.value)
262
279
  }
263
280
 
281
+ # simple_counters have higher priority than segmented_totals
282
+ counters = segmented_totals
283
+ counters.merge!(segmented_counters)
284
+ counters.merge!(simple_counters)
285
+
264
286
  data = []
265
287
  counters.each_pair {|ak,up|
288
+ p [ak.tag, ak.time, up.normalized_value(@normalize_factor), ak.seg_key, ak.seg_val, up.mode]
266
289
  data << [ak.tag, ak.time, up.normalized_value(@normalize_factor), ak.seg_key, ak.seg_val, up.mode]
267
290
  }
268
291
 
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-metricsense
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-08 00:00:00.000000000 Z
11
+ date: 2014-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.10.6
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.10.6
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - ! '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.8.7
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - ! '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.8.7
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - ! '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: 1.0.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.0.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: simplecov
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: 0.5.4
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - ! '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.5.4
69
69
  description: MetricSense - application metrics aggregation plugin for Fluentd
@@ -72,7 +72,7 @@ executables: []
72
72
  extensions: []
73
73
  extra_rdoc_files: []
74
74
  files:
75
- - ".gitignore"
75
+ - .gitignore
76
76
  - Gemfile
77
77
  - README.rdoc
78
78
  - Rakefile
@@ -91,12 +91,12 @@ require_paths:
91
91
  - lib
92
92
  required_ruby_version: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - ! '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  requirements:
99
- - - ">="
99
+ - - ! '>='
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  requirements: []
@@ -106,3 +106,4 @@ signing_key:
106
106
  specification_version: 4
107
107
  summary: MetricSense - application metrics aggregation plugin for Fluentd
108
108
  test_files: []
109
+ has_rdoc: false